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