• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_
6 #define CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_
7 
8 #include "base/posix/global_descriptors.h"
9 #include "ipc/ipc_descriptors.h"
10 
11 namespace content {
12 
13 // Contents of the initial message sent from the zygote to the browser when it
14 // is ready to go.
15 static const char kZygoteHelloMessage[] = "ZYGOTE_OK";
16 
17 // Maximum allowable length for messages sent to the zygote.
18 const size_t kZygoteMaxMessageLength = 8192;
19 
20 // File descriptors initialized by the Zygote Host
21 const int kZygoteSocketPairFd =
22     kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor;
23 // This file descriptor is special. It is passed to the Zygote and a setuid
24 // helper will be called to locate the process of the Zygote on the system.
25 // This mechanism is used when multiple PID namespaces exist because of the
26 // setuid sandbox.
27 // It is very important that this file descriptor does not exist in multiple
28 // processes.
29 // This number must be kept in sync in sandbox/linux/suid/sandbox.c
30 const int kZygoteIdFd = 7;
31 
32 // These are the command codes used on the wire between the browser and the
33 // zygote.
34 enum {
35   // Fork off a new renderer.
36   kZygoteCommandFork = 0,
37 
38   // Reap a renderer child.
39   kZygoteCommandReap = 1,
40 
41   // Check what happened to a child process.
42   kZygoteCommandGetTerminationStatus = 2,
43 
44   // Read a bitmask of kSandboxLinux*
45   kZygoteCommandGetSandboxStatus = 3
46 };
47 
48 }  // namespace content
49 
50 #endif  // CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_
51