Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: content/public/common/zygote_fork_delegate_linux.h

Issue 269543014: Use RecvMsgWithPid to find real PID for zygote children (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore error handling code paths Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ 5 #ifndef CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
6 #define CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ 6 #define CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
7 7
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Returns 'true' if the delegate would like to handle a given fork 42 // Returns 'true' if the delegate would like to handle a given fork
43 // request. Otherwise returns false. Optionally, fills in uma_name et al 43 // request. Otherwise returns false. Optionally, fills in uma_name et al
44 // with a report the helper wants to make via UMA_HISTOGRAM_ENUMERATION. 44 // with a report the helper wants to make via UMA_HISTOGRAM_ENUMERATION.
45 virtual bool CanHelp(const std::string& process_type, std::string* uma_name, 45 virtual bool CanHelp(const std::string& process_type, std::string* uma_name,
46 int* uma_sample, int* uma_boundary_value) = 0; 46 int* uma_sample, int* uma_boundary_value) = 0;
47 47
48 // Indexes of FDs in the vector passed to Fork(). 48 // Indexes of FDs in the vector passed to Fork().
49 enum { 49 enum {
50 // Used to pass in the descriptor for talking to the Browser 50 // Used to pass in the descriptor for talking to the Browser
51 kBrowserFDIndex, 51 kBrowserFDIndex,
52 // The next two are used in the protocol for discovering the 52 // The PID oracle is used in the protocol for discovering the
53 // child processes real PID from within the SUID sandbox. See 53 // child process's real PID from within the SUID sandbox.
54 // http://code.google.com/p/chromium/wiki/LinuxZygote 54 // The child process is required to write to the socket after
55 kDummyFDIndex, 55 // successfully forking.
56 kParentFDIndex, 56 kPIDOracleFDIndex,
57 kNumPassedFDs // Number of FDs in the vector passed to Fork(). 57 kNumPassedFDs // Number of FDs in the vector passed to Fork().
58 }; 58 };
59 59
60 // Delegate forks, returning a -1 on failure. Outside the 60 // Delegate forks, returning a -1 on failure. Outside the
61 // suid sandbox, Fork() returns the Linux process ID. 61 // suid sandbox, Fork() returns the Linux process ID.
62 // This method is not aware of any potential pid namespaces, so it'll 62 // This method is not aware of any potential pid namespaces, so it'll
63 // return a raw pid just like fork() would. 63 // return a raw pid just like fork() would.
64 // Delegate is responsible for communicating the channel ID to the 64 // Delegate is responsible for communicating the channel ID to the
65 // newly created child process. 65 // newly created child process.
66 virtual pid_t Fork(const std::string& process_type, 66 virtual pid_t Fork(const std::string& process_type,
67 const std::vector<int>& fds, 67 const std::vector<int>& fds,
68 const std::string& channel_id) = 0; 68 const std::string& channel_id) = 0;
69 69
70 // The fork delegate must also assume the role of waiting for its children 70 // The fork delegate must also assume the role of waiting for its children
71 // since the caller will not be their parents and cannot do it. |pid| here 71 // since the caller will not be their parents and cannot do it. |pid| here
72 // should be a pid that has been returned by the Fork() method. i.e. This 72 // should be a pid that has been returned by the Fork() method. i.e. This
73 // method is completely unaware of eventual PID namespaces due to sandboxing. 73 // method is completely unaware of eventual PID namespaces due to sandboxing.
74 // |known_dead| indicates that the process is already dead and that a 74 // |known_dead| indicates that the process is already dead and that a
75 // blocking wait() should be performed. In this case, GetTerminationStatus() 75 // blocking wait() should be performed. In this case, GetTerminationStatus()
76 // will send a SIGKILL to the target process first. 76 // will send a SIGKILL to the target process first.
77 virtual bool GetTerminationStatus(pid_t pid, bool known_dead, 77 virtual bool GetTerminationStatus(pid_t pid, bool known_dead,
78 base::TerminationStatus* status, 78 base::TerminationStatus* status,
79 int* exit_code) = 0; 79 int* exit_code) = 0;
80 }; 80 };
81 81
82 } // namespace content 82 } // namespace content
83 83
84 #endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ 84 #endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
OLDNEW
« no previous file with comments | « content/public/common/child_process_sandbox_support_linux.h ('k') | content/zygote/zygote_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698