diff options
author | mdempsky@chromium.org <mdempsky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-08 01:26:28 +0000 |
---|---|---|
committer | mdempsky@chromium.org <mdempsky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-08 01:26:28 +0000 |
commit | 53cbbe25aba92ee69a80f28f3e3c2201e1d87d98 (patch) | |
tree | 273509ef85f2e275a426e835acf73d04a32aa7f0 /content/common/zygote_commands_linux.h | |
parent | e8d007a131358658444af55a899b55771d958c5c (diff) | |
download | chromium_src-53cbbe25aba92ee69a80f28f3e3c2201e1d87d98.zip chromium_src-53cbbe25aba92ee69a80f28f3e3c2201e1d87d98.tar.gz chromium_src-53cbbe25aba92ee69a80f28f3e3c2201e1d87d98.tar.bz2 |
Use RecvMsgWithPid to find real PID for zygote children
The new PID discovery protocol now works as follows:
1. The ZygoteHost allocates a UNIX socket pair and includes one end
with its fork request to the zygote process.
2. After forking, the zygote child process sends a message over the
UNIX socket pair.
3. The ZygoteHost receives the message and a PID for the sender (i.e.,
child), and writes the PID back over the control socket to the zygote.
If the zygote fails to fork a child, its end of the socket pair will
be closed, and the ZygoteHost will receive EOF instead of a message.
4. In the non-NaCl case, the zygote writes the child's PID over a pipe
for the child to receive. (In the NaCl case, this pipe is no longer
used and no PID value is sent to the NaCl child process.)
5. Finally, the zygote sends its normal pickled response back to the
ZygoteHost.
Two manual tests to make sure this works:
1. Make sure that the "End Process" button in the "Task Manager" dialog
still terminates renderer and NaCl processes correctly under Linux.
2. Make sure that Linux Chrome release builds gracefully fail (i.e.,
don't crash) when nacl_helper is missing at chrome startup and the user
navigates to a page that uses NaCl; e.g.,
http://gonativeclient.appspot.com/demo/ and click "Game of Life".
BUG=357670
TEST=manual: see above
NOTRY=true
Review URL: https://codereview.chromium.org/269543014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269011 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/zygote_commands_linux.h')
-rw-r--r-- | content/common/zygote_commands_linux.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/content/common/zygote_commands_linux.h b/content/common/zygote_commands_linux.h index 9be0462..ca5a1d5 100644 --- a/content/common/zygote_commands_linux.h +++ b/content/common/zygote_commands_linux.h @@ -18,6 +18,10 @@ static const char kZygoteBootMessage[] = "ZYGOTE_BOOT"; // is ready to go. static const char kZygoteHelloMessage[] = "ZYGOTE_OK"; +// Message sent by zygote children to the browser so the browser can discover +// the sending child's process ID. +static const char kZygoteChildPingMessage[] = "CHILD_PING"; + // Maximum allowable length for messages sent to the zygote. const size_t kZygoteMaxMessageLength = 8192; @@ -38,7 +42,11 @@ enum { kZygoteCommandGetTerminationStatus = 2, // Read a bitmask of kSandboxLinux* - kZygoteCommandGetSandboxStatus = 3 + kZygoteCommandGetSandboxStatus = 3, + + // Not a real zygote command, but a subcommand used during the zygote fork + // protocol. Sends the child's PID as seen from the browser process. + kZygoteCommandForkRealPID = 4 }; } // namespace content |