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

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

Issue 24449002: NaCl: Clean up how FDs are passed to nacl_helper instances on Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review - cleanup Created 7 years, 2 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
« no previous file with comments | « components/nacl/zygote/nacl_fork_delegate_linux.cc ('k') | content/zygote/zygote_linux.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 25 matching lines...) Expand all
36 virtual void InitialUMA(std::string* uma_name, 36 virtual void InitialUMA(std::string* uma_name,
37 int* uma_sample, 37 int* uma_sample,
38 int* uma_boundary_value) = 0; 38 int* uma_boundary_value) = 0;
39 39
40 // Returns 'true' if the delegate would like to handle a given fork 40 // Returns 'true' if the delegate would like to handle a given fork
41 // request. Otherwise returns false. Optionally, fills in uma_name et al 41 // request. Otherwise returns false. Optionally, fills in uma_name et al
42 // with a report the helper wants to make via UMA_HISTOGRAM_ENUMERATION. 42 // with a report the helper wants to make via UMA_HISTOGRAM_ENUMERATION.
43 virtual bool CanHelp(const std::string& process_type, std::string* uma_name, 43 virtual bool CanHelp(const std::string& process_type, std::string* uma_name,
44 int* uma_sample, int* uma_boundary_value) = 0; 44 int* uma_sample, int* uma_boundary_value) = 0;
45 45
46 // Indexes of FDs in the vector passed to Fork().
47 enum {
48 // Used to pass in the descriptor for talking to the Browser
49 kBrowserFDIndex,
50 // The next two are used in the protocol for discovering the
51 // child processes real PID from within the SUID sandbox. See
52 // http://code.google.com/p/chromium/wiki/LinuxZygote
53 kDummyFDIndex,
54 kParentFDIndex,
55 kNumPassedFDs // Number of FDs in the vector passed to Fork().
56 };
57
46 // Delegate forks, returning a -1 on failure. Outside the 58 // Delegate forks, returning a -1 on failure. Outside the
47 // suid sandbox, Fork() returns the Linux process ID. 59 // suid sandbox, Fork() returns the Linux process ID.
48 // 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
49 // return a raw pid just like fork() would. 61 // return a raw pid just like fork() would.
50 virtual pid_t Fork(const std::vector<int>& fds) = 0; 62 virtual pid_t Fork(const std::vector<int>& fds) = 0;
51 63
52 // After a successful fork, signal the child to indicate that 64 // After a successful fork, signal the child to indicate that
53 // the child's PID has been received. Also communicate the 65 // the child's PID has been received. Also communicate the
54 // channel switch as a part of acknowledgement message. 66 // channel switch as a part of acknowledgement message.
55 virtual bool AckChild(int fd, const std::string& channel_switch) = 0; 67 virtual bool AckChild(int fd, const std::string& channel_switch) = 0;
56 68
57 // The fork delegate must also assume the role of waiting for its children 69 // The fork delegate must also assume the role of waiting for its children
58 // since the caller will not be their parents and cannot do it. |pid| here 70 // since the caller will not be their parents and cannot do it. |pid| here
59 // should be a pid that has been returned by the Fork() method. i.e. This 71 // should be a pid that has been returned by the Fork() method. i.e. This
60 // method is completely unaware of eventual PID namespaces due to sandboxing. 72 // method is completely unaware of eventual PID namespaces due to sandboxing.
61 // |known_dead| indicates that the process is already dead and that a 73 // |known_dead| indicates that the process is already dead and that a
62 // blocking wait() should be performed. In this case, GetTerminationStatus() 74 // blocking wait() should be performed. In this case, GetTerminationStatus()
63 // will send a SIGKILL to the target process first. 75 // will send a SIGKILL to the target process first.
64 virtual bool GetTerminationStatus(pid_t pid, bool known_dead, 76 virtual bool GetTerminationStatus(pid_t pid, bool known_dead,
65 base::TerminationStatus* status, 77 base::TerminationStatus* status,
66 int* exit_code) = 0; 78 int* exit_code) = 0;
67 }; 79 };
68 80
69 } // namespace content 81 } // namespace content
70 82
71 #endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ 83 #endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
OLDNEW
« no previous file with comments | « components/nacl/zygote/nacl_fork_delegate_linux.cc ('k') | content/zygote/zygote_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698