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

Side by Side Diff: chrome/browser/zygote_host_linux.h

Issue 361002: Add support for getting the real process id from within the suid sandbox. The... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_ 5 #ifndef CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_
6 #define CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_ 6 #define CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_
7 7
8 #include <unistd.h>
9
8 #include <string> 10 #include <string>
9 #include <vector> 11 #include <vector>
10 12
11 #include <unistd.h>
12
13 #include "base/global_descriptors_posix.h" 13 #include "base/global_descriptors_posix.h"
14 #include "base/process.h" 14 #include "base/process.h"
15 15
16 template<typename Type> 16 template<typename Type>
17 struct DefaultSingletonTraits; 17 struct DefaultSingletonTraits;
18 18
19 static const char kZygoteMagic[] = "ZYGOTE_OK";
20
19 // http://code.google.com/p/chromium/wiki/LinuxZygote 21 // http://code.google.com/p/chromium/wiki/LinuxZygote
20 22
21 // The zygote host is the interface, in the browser process, to the zygote 23 // The zygote host is the interface, in the browser process, to the zygote
22 // process. 24 // process.
23 class ZygoteHost { 25 class ZygoteHost {
24 public: 26 public:
25 ~ZygoteHost(); 27 void Init(const std::string& sandbox_cmd);
26 28
27 pid_t ForkRenderer(const std::vector<std::string>& command_line, 29 pid_t ForkRenderer(const std::vector<std::string>& command_line,
28 const base::GlobalDescriptors::Mapping& mapping); 30 const base::GlobalDescriptors::Mapping& mapping);
29 void EnsureProcessTerminated(pid_t process); 31 void EnsureProcessTerminated(pid_t process);
30 32
31 // Get the termination status (exit code) of the process and return true if 33 // Get the termination status (exit code) of the process and return true if
32 // the status indicates the process crashed. |child_exited| is set to true 34 // the status indicates the process crashed. |child_exited| is set to true
33 // iff the child process has terminated. (|child_exited| may be NULL.) 35 // iff the child process has terminated. (|child_exited| may be NULL.)
34 bool DidProcessCrash(base::ProcessHandle handle, bool* child_exited); 36 bool DidProcessCrash(base::ProcessHandle handle, bool* child_exited);
35 37
36 // These are the command codes used on the wire between the browser and the 38 // These are the command codes used on the wire between the browser and the
37 // zygote. 39 // zygote.
38 enum { 40 enum {
39 kCmdFork = 0, // Fork off a new renderer. 41 kCmdFork = 0, // Fork off a new renderer.
40 kCmdReap = 1, // Reap a renderer child. 42 kCmdReap = 1, // Reap a renderer child.
41 kCmdDidProcessCrash = 2, // Check if child process crashed. 43 kCmdDidProcessCrash = 2, // Check if child process crashed.
42 }; 44 };
43 45
44 pid_t pid() const { return pid_; } 46 pid_t pid() const { return pid_; }
45 47
46 private: 48 private:
47 friend struct DefaultSingletonTraits<ZygoteHost>; 49 friend struct DefaultSingletonTraits<ZygoteHost>;
48 ZygoteHost(); 50 ZygoteHost();
49 void LaunchZygoteProcess(); 51 ~ZygoteHost();
50 52
51 int control_fd_; // the socket to the zygote 53 int control_fd_; // the socket to the zygote
52 pid_t pid_; 54 pid_t pid_;
55 bool init_;
53 }; 56 };
54 57
55 #endif // CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_ 58 #endif // CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_sandbox_host_linux.cc ('k') | chrome/browser/zygote_host_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698