mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 606074: ensure that we share the Android system properties memory-map with the child process, r=cjones, a=blocking-fennec:2.0:mfinkle
This commit is contained in:
parent
855b6fadc7
commit
091e50c7d7
@ -70,12 +70,20 @@
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <sys/system_properties.h>
|
||||
#include "APKOpen.h"
|
||||
#endif
|
||||
|
||||
using mozilla::MonitorAutoEnter;
|
||||
using mozilla::ipc::GeckoChildProcessHost;
|
||||
|
||||
#ifdef ANDROID
|
||||
// Like its predecessor in nsExceptionHandler.cpp, this is
|
||||
// the magic number of a file descriptor remapping we must
|
||||
// preserve for the child process.
|
||||
static const int kMagicAndroidSystemPropFd = 5;
|
||||
#endif
|
||||
|
||||
template<>
|
||||
struct RunnableMethodTraits<GeckoChildProcessHost>
|
||||
{
|
||||
@ -406,7 +414,22 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts, b
|
||||
// fill the last arg with something if there's no cache
|
||||
if (cacheStr.IsEmpty())
|
||||
cacheStr.AppendLiteral("-");
|
||||
#endif
|
||||
|
||||
// Remap the Android property workspace to a well-known int,
|
||||
// and update the environment to reflect the new value for the
|
||||
// child process.
|
||||
const char *apws = getenv("ANDROID_PROPERTY_WORKSPACE");
|
||||
if (apws) {
|
||||
int fd = atoi(apws);
|
||||
mFileMap.push_back(std::pair<int, int>(fd, kMagicAndroidSystemPropFd));
|
||||
|
||||
char buf[32];
|
||||
char *szptr = strchr(apws, ',');
|
||||
|
||||
snprintf(buf, sizeof(buf), "%d%s", kMagicAndroidSystemPropFd, szptr);
|
||||
newEnvVars["ANDROID_PROPERTY_WORKSPACE"] = buf;
|
||||
}
|
||||
#endif // ANDROID
|
||||
|
||||
// remap the IPC socket fd to a well-known int, as the OS does for
|
||||
// STDOUT_FILENO, for example
|
||||
|
Loading…
Reference in New Issue
Block a user