summaryrefslogtreecommitdiffstats
path: root/content/zygote/zygote_linux.h
diff options
context:
space:
mode:
authormdempsky@chromium.org <mdempsky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-08 01:26:28 +0000
committermdempsky@chromium.org <mdempsky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-08 01:26:28 +0000
commit53cbbe25aba92ee69a80f28f3e3c2201e1d87d98 (patch)
tree273509ef85f2e275a426e835acf73d04a32aa7f0 /content/zygote/zygote_linux.h
parente8d007a131358658444af55a899b55771d958c5c (diff)
downloadchromium_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/zygote/zygote_linux.h')
-rw-r--r--content/zygote/zygote_linux.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/content/zygote/zygote_linux.h b/content/zygote/zygote_linux.h
index 4aa2f03..8e1996c 100644
--- a/content/zygote/zygote_linux.h
+++ b/content/zygote/zygote_linux.h
@@ -75,12 +75,16 @@ class Zygote {
// This is equivalent to fork(), except that, when using the SUID sandbox, it
// returns the real PID of the child process as it appears outside the
- // sandbox, rather than returning the PID inside the sandbox. Optionally, it
- // fills in uma_name et al with a report the helper wants to make via
- // UMA_HISTOGRAM_ENUMERATION.
+ // sandbox, rather than returning the PID inside the sandbox. The child's
+ // real PID is determined by having it call content::SendZygoteChildPing(int)
+ // using the |pid_oracle| descriptor.
+ // Finally, when using a ZygoteForkDelegate helper, |uma_name|, |uma_sample|,
+ // and |uma_boundary_value| may be set if the helper wants to make a UMA
+ // report via UMA_HISTOGRAM_ENUMERATION.
int ForkWithRealPid(const std::string& process_type,
const base::GlobalDescriptors::Mapping& fd_mapping,
const std::string& channel_id,
+ base::ScopedFD pid_oracle,
std::string* uma_name,
int* uma_sample,
int* uma_boundary_value);