Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: sw=4 ts=4 et : |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include <dlfcn.h> |
michael@0 | 8 | #include <android/log.h> |
michael@0 | 9 | |
michael@0 | 10 | int |
michael@0 | 11 | main(int argc, char* argv[]) |
michael@0 | 12 | { |
michael@0 | 13 | // Check for the absolute minimum number of args we need to move |
michael@0 | 14 | // forward here. We expect the last arg to be the child process type. |
michael@0 | 15 | if (argc < 2) |
michael@0 | 16 | return 1; |
michael@0 | 17 | |
michael@0 | 18 | void *mozloader_handle = dlopen("libmozglue.so", RTLD_LAZY); |
michael@0 | 19 | if (!mozloader_handle) { |
michael@0 | 20 | __android_log_print(ANDROID_LOG_ERROR, "GeckoChildLoad", |
michael@0 | 21 | "Couldn't load mozloader because %s", dlerror()); |
michael@0 | 22 | return 1; |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | typedef int (*ChildProcessInit_t)(int, char**); |
michael@0 | 26 | ChildProcessInit_t fChildProcessInit = |
michael@0 | 27 | (ChildProcessInit_t)dlsym(mozloader_handle, "ChildProcessInit"); |
michael@0 | 28 | if (!fChildProcessInit) { |
michael@0 | 29 | __android_log_print(ANDROID_LOG_ERROR, "GeckoChildLoad", |
michael@0 | 30 | "Couldn't load cpi_t because %s", dlerror()); |
michael@0 | 31 | return 1; |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | return fChildProcessInit(argc, argv); |
michael@0 | 35 | } |