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

Side by Side Diff: content/common/zygote_commands_linux.h

Issue 23956010: Define magic descriptors in one place. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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
« no previous file with comments | « content/browser/zygote_host/zygote_host_impl_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_COMMON_ZYGOTE_COMMANDS_LINUX_H_ 5 #ifndef CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_
6 #define CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_ 6 #define CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_
7 7
8 #include "content/common/child_process_sandbox_support_impl_linux.h"
9
8 namespace content { 10 namespace content {
9 11
10 // Contents of the initial message sent from the zygote to the browser when it 12 // Contents of the initial message sent from the zygote to the browser when it
11 // is ready to go. 13 // is ready to go.
12 static const char kZygoteHelloMessage[] = "ZYGOTE_OK"; 14 static const char kZygoteHelloMessage[] = "ZYGOTE_OK";
13 15
14 // Maximum allowable length for messages sent to the zygote. 16 // Maximum allowable length for messages sent to the zygote.
15 const size_t kZygoteMaxMessageLength = 8192; 17 const size_t kZygoteMaxMessageLength = 8192;
16 18
17 // File descriptors initialized by the Zygote Host 19 // File descriptors initialized by the Zygote Host
18 const int kZygoteSocketPairFd = 3; 20 const int kMagicZygoteDescriptor =
agl 2013/09/09 16:59:07 This renaming seems superfluous.
19 const int kZygoteRendererSocketFd = 5; 21 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor;
22 const int kMagicSandboxIPCDescriptor = GetSandboxFD();
agl 2013/09/09 16:59:07 No global initialisers.
20 // This file descriptor is special. It is passed to the Zygote and a setuid 23 // This file descriptor is special. It is passed to the Zygote and a setuid
21 // helper will be called to locate the process of the Zygote on the system. 24 // helper will be called to locate the process of the Zygote on the system.
22 // This mechanism is used when multiple PID namespaces exist because of the 25 // This mechanism is used when multiple PID namespaces exist because of the
23 // setuid sandbox. 26 // setuid sandbox.
24 // It is very important that this file descriptor does not exist in multiple 27 // It is very important that this file descriptor does not exist in multiple
25 // processes. 28 // processes.
26 // This number must be kept in sync in sandbox/linux/suid/sandbox.c 29 // This number must be kept in sync in sandbox/linux/suid/sandbox.c
27 const int kZygoteIdFd = 7; 30 const int kZygoteIdFd = 7;
28 31
29 // These are the command codes used on the wire between the browser and the 32 // These are the command codes used on the wire between the browser and the
30 // zygote. 33 // zygote.
31 enum { 34 enum {
32 // Fork off a new renderer. 35 // Fork off a new renderer.
33 kZygoteCommandFork = 0, 36 kZygoteCommandFork = 0,
34 37
35 // Reap a renderer child. 38 // Reap a renderer child.
36 kZygoteCommandReap = 1, 39 kZygoteCommandReap = 1,
37 40
38 // Check what happened to a child process. 41 // Check what happened to a child process.
39 kZygoteCommandGetTerminationStatus = 2, 42 kZygoteCommandGetTerminationStatus = 2,
40 43
41 // Read a bitmask of kSandboxLinux* 44 // Read a bitmask of kSandboxLinux*
42 kZygoteCommandGetSandboxStatus = 3 45 kZygoteCommandGetSandboxStatus = 3
43 }; 46 };
44 47
45 } // namespace content 48 } // namespace content
46 49
47 #endif // CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_ 50 #endif // CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_
OLDNEW
« no previous file with comments | « content/browser/zygote_host/zygote_host_impl_linux.cc ('k') | content/zygote/zygote_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698