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
11namespace content {
12
13// Contents of the initial message sent from the zygote to the browser right
14// after it starts.
15static const char kZygoteBootMessage[] = "ZYGOTE_BOOT";
16
17// Contents of the initial message sent from the zygote to the browser when it
18// is ready to go.
19static const char kZygoteHelloMessage[] = "ZYGOTE_OK";
20
21// Message sent by zygote children to the browser so the browser can discover
22// the sending child's process ID.
23static const char kZygoteChildPingMessage[] = "CHILD_PING";
24
25// Maximum allowable length for messages sent to the zygote.
26const size_t kZygoteMaxMessageLength = 8192;
27
28// File descriptors initialized by the Zygote Host
29const int kZygoteSocketPairFd =
30    kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor;
31
32// These are the command codes used on the wire between the browser and the
33// zygote.
34enum {
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  // Not a real zygote command, but a subcommand used during the zygote fork
48  // protocol.  Sends the child's PID as seen from the browser process.
49  kZygoteCommandForkRealPID = 4
50};
51
52}  // namespace content
53
54#endif  // CONTENT_COMMON_ZYGOTE_COMMANDS_LINUX_H_
55