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

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

Issue 240463005: Stop using chrome-sandbox to determine real pids (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix an embarassing number of compile errors 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 // Used to pass in the descriptor for talking to the fork parent process.
53 // child processes real PID from within the SUID sandbox. See 53 // After forking, the child process is responsible for discovering its own
54 // http://code.google.com/p/chromium/wiki/LinuxZygote 54 // global process ID and sending it to the parent via this descriptor.
55 kDummyFDIndex, 55 // See http://code.google.com/p/chromium/wiki/LinuxZygote
56 kParentFDIndex, 56 kParentFDIndex,
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 // The child process is expected to send its global pid to the parent process
63 // return a raw pid just like fork() would. 63 // (see kParentFDIndex above), but this function still returns a raw pid just
64 // like fork() would.
64 // Delegate is responsible for communicating the channel ID to the 65 // Delegate is responsible for communicating the channel ID to the
65 // newly created child process. 66 // newly created child process.
66 virtual pid_t Fork(const std::string& process_type, 67 virtual pid_t Fork(const std::string& process_type,
67 const std::vector<int>& fds, 68 const std::vector<int>& fds,
68 const std::string& channel_id) = 0; 69 const std::string& channel_id) = 0;
69 70
70 // The fork delegate must also assume the role of waiting for its children 71 // 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 72 // 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 73 // 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. 74 // method is completely unaware of eventual PID namespaces due to sandboxing.
74 // |known_dead| indicates that the process is already dead and that a 75 // |known_dead| indicates that the process is already dead and that a
75 // blocking wait() should be performed. In this case, GetTerminationStatus() 76 // blocking wait() should be performed. In this case, GetTerminationStatus()
76 // will send a SIGKILL to the target process first. 77 // will send a SIGKILL to the target process first.
77 virtual bool GetTerminationStatus(pid_t pid, bool known_dead, 78 virtual bool GetTerminationStatus(pid_t pid, bool known_dead,
78 base::TerminationStatus* status, 79 base::TerminationStatus* status,
79 int* exit_code) = 0; 80 int* exit_code) = 0;
80 }; 81 };
81 82
82 } // namespace content 83 } // namespace content
83 84
84 #endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ 85 #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.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698