1 // Copyright (c) 2013 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 #include "base/process/launch.h"
6 #include "build/build_config.h"
7 
8 namespace base {
9 
LaunchOptions()10 LaunchOptions::LaunchOptions()
11     : wait(false),
12 #if defined(OS_WIN)
13       start_hidden(false),
14       handles_to_inherit(NULL),
15       inherit_handles(false),
16       as_user(NULL),
17       empty_desktop_name(false),
18       job_handle(NULL),
19       stdin_handle(NULL),
20       stdout_handle(NULL),
21       stderr_handle(NULL),
22       force_breakaway_from_job_(false)
23 #else
24       clear_environ(false),
25       fds_to_remap(NULL),
26       maximize_rlimits(NULL),
27       new_process_group(false)
28 #if defined(OS_LINUX)
29       , clone_flags(0)
30       , allow_new_privs(false)
31       , kill_on_parent_death(false)
32 #endif  // OS_LINUX
33 #if defined(OS_POSIX)
34       , pre_exec_delegate(NULL)
35 #endif  // OS_POSIX
36 #if defined(OS_CHROMEOS)
37       , ctrl_terminal_fd(-1)
38 #endif  // OS_CHROMEOS
39 #endif  // !defined(OS_WIN)
40     {
41 }
42 
~LaunchOptions()43 LaunchOptions::~LaunchOptions() {
44 }
45 
LaunchOptionsForTest()46 LaunchOptions LaunchOptionsForTest() {
47   LaunchOptions options;
48 #if defined(OS_LINUX)
49   // To prevent accidental privilege sharing to an untrusted child, processes
50   // are started with PR_SET_NO_NEW_PRIVS. Do not set that here, since this
51   // new child will be used for testing only.
52   options.allow_new_privs = true;
53 #endif
54   return options;
55 }
56 
57 }  // namespace base
58