summaryrefslogtreecommitdiffstats
path: root/base/process
diff options
context:
space:
mode:
Diffstat (limited to 'base/process')
-rw-r--r--base/process/launch.h3
-rw-r--r--base/process/launch_posix.cc25
2 files changed, 13 insertions, 15 deletions
diff --git a/base/process/launch.h b/base/process/launch.h
index 336bfba..e11d1c0 100644
--- a/base/process/launch.h
+++ b/base/process/launch.h
@@ -7,7 +7,6 @@
#ifndef BASE_PROCESS_LAUNCH_H_
#define BASE_PROCESS_LAUNCH_H_
-#include <set>
#include <string>
#include <utility>
#include <vector>
@@ -102,7 +101,7 @@ struct BASE_EXPORT LaunchOptions {
// Each element is an RLIMIT_* constant that should be raised to its
// rlim_max. This pointer is owned by the caller and must live through
// the call to LaunchProcess().
- const std::set<int>* maximize_rlimits;
+ const std::vector<int>* maximize_rlimits;
// If true, start the process in a new process group, instead of
// inheriting the parent's process group. The pgid of the child process
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
index 55a16dc..daa055d 100644
--- a/base/process/launch_posix.cc
+++ b/base/process/launch_posix.cc
@@ -320,6 +320,9 @@ bool LaunchProcess(const std::vector<std::string>& argv,
} else if (pid == 0) {
// Child process
+ // DANGER: no calls to malloc or locks are allowed from now on:
+ // http://crbug.com/36678
+
// DANGER: fork() rule: in the child, if you don't end up doing exec*(),
// you call _exit() instead of exit(). This is because _exit() does not
// call any previously-registered (in the parent) exit handlers, which
@@ -358,16 +361,14 @@ bool LaunchProcess(const std::vector<std::string>& argv,
if (options.maximize_rlimits) {
// Some resource limits need to be maximal in this child.
- std::set<int>::const_iterator resource;
- for (resource = options.maximize_rlimits->begin();
- resource != options.maximize_rlimits->end();
- ++resource) {
+ for (size_t i = 0; i < options.maximize_rlimits->size(); ++i) {
+ const int resource = (*options.maximize_rlimits)[i];
struct rlimit limit;
- if (getrlimit(*resource, &limit) < 0) {
+ if (getrlimit(resource, &limit) < 0) {
RAW_LOG(WARNING, "getrlimit failed");
} else if (limit.rlim_cur < limit.rlim_max) {
limit.rlim_cur = limit.rlim_max;
- if (setrlimit(*resource, &limit) < 0) {
+ if (setrlimit(resource, &limit) < 0) {
RAW_LOG(WARNING, "setrlimit failed");
}
}
@@ -390,9 +391,6 @@ bool LaunchProcess(const std::vector<std::string>& argv,
memset(reinterpret_cast<void*>(malloc), 0xff, 8);
#endif // 0
- // DANGER: no calls to malloc or locks are allowed from now on:
- // http://crbug.com/36678
-
#if defined(OS_CHROMEOS)
if (options.ctrl_terminal_fd >= 0) {
// Set process' controlling terminal.
@@ -521,11 +519,12 @@ static GetAppOutputInternalResult GetAppOutputInternal(
return EXECUTE_FAILURE;
case 0: // child
{
+ // DANGER: no calls to malloc or locks are allowed from now on:
+ // http://crbug.com/36678
+
#if defined(OS_MACOSX)
RestoreDefaultExceptionHandler();
#endif
- // DANGER: no calls to malloc or locks are allowed from now on:
- // http://crbug.com/36678
// Obscure fork() rule: in the child, if you don't end up doing exec*(),
// you call _exit() instead of exit(). This is because _exit() does not
@@ -547,8 +546,8 @@ static GetAppOutputInternalResult GetAppOutputInternal(
// Adding another element here? Remeber to increase the argument to
// reserve(), above.
- std::copy(fd_shuffle1.begin(), fd_shuffle1.end(),
- std::back_inserter(fd_shuffle2));
+ for (size_t i = 0; i < fd_shuffle1.size(); ++i)
+ fd_shuffle2.push_back(fd_shuffle1[i]);
if (!ShuffleFileDescriptors(&fd_shuffle1))
_exit(127);