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

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

Issue 240673002: Simplify ZygoteForkDelegate API further (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // http://code.google.com/p/chromium/wiki/LinuxZygote 52 // http://code.google.com/p/chromium/wiki/LinuxZygote
53 kDummyFDIndex, 53 kDummyFDIndex,
54 kParentFDIndex, 54 kParentFDIndex,
55 kNumPassedFDs // Number of FDs in the vector passed to Fork(). 55 kNumPassedFDs // Number of FDs in the vector passed to Fork().
56 }; 56 };
57 57
58 // Delegate forks, returning a -1 on failure. Outside the 58 // Delegate forks, returning a -1 on failure. Outside the
59 // suid sandbox, Fork() returns the Linux process ID. 59 // suid sandbox, Fork() returns the Linux process ID.
60 // This method is not aware of any potential pid namespaces, so it'll 60 // This method is not aware of any potential pid namespaces, so it'll
61 // return a raw pid just like fork() would. 61 // return a raw pid just like fork() would.
62 // Delegate is responsible for communicating the channel ID to the
63 // newly created child process.
62 virtual pid_t Fork(const std::string& process_type, 64 virtual pid_t Fork(const std::string& process_type,
63 const std::vector<int>& fds) = 0; 65 const std::vector<int>& fds,
64 66 const std::string& channel_id) = 0;
65 // After a successful fork, signal the child to indicate that
66 // the child's PID has been received. Also communicate the
67 // channel ID as a part of acknowledgement message.
68 virtual bool AckChild(int fd, const std::string& channel_id) = 0;
69 67
70 // The fork delegate must also assume the role of waiting for its children 68 // 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 69 // 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 70 // 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. 71 // method is completely unaware of eventual PID namespaces due to sandboxing.
74 // |known_dead| indicates that the process is already dead and that a 72 // |known_dead| indicates that the process is already dead and that a
75 // blocking wait() should be performed. In this case, GetTerminationStatus() 73 // blocking wait() should be performed. In this case, GetTerminationStatus()
76 // will send a SIGKILL to the target process first. 74 // will send a SIGKILL to the target process first.
77 virtual bool GetTerminationStatus(pid_t pid, bool known_dead, 75 virtual bool GetTerminationStatus(pid_t pid, bool known_dead,
78 base::TerminationStatus* status, 76 base::TerminationStatus* status,
79 int* exit_code) = 0; 77 int* exit_code) = 0;
80 }; 78 };
81 79
82 } // namespace content 80 } // namespace content
83 81
84 #endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ 82 #endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698