aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
Diffstat (limited to 'executor')
-rw-r--r--executor/executor.cc6
-rw-r--r--executor/executor_bsd.h5
2 files changed, 5 insertions, 6 deletions
diff --git a/executor/executor.cc b/executor/executor.cc
index d6e7b75b3..6569326d3 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -12,7 +12,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/resource.h>
#include <time.h>
#include <unistd.h>
@@ -423,11 +422,6 @@ int main(int argc, char** argv)
void setup_control_pipes()
{
- // Makes sure the file descriptor limit is sufficient.
- struct rlimit rlim;
- rlim.rlim_cur = rlim.rlim_max = kMaxFd;
- setrlimit(RLIMIT_NOFILE, &rlim);
-
if (dup2(0, kInPipeFd) < 0)
fail("dup2(0, kInPipeFd) failed");
if (dup2(1, kOutPipeFd) < 0)
diff --git a/executor/executor_bsd.h b/executor/executor_bsd.h
index 8f364ca13..b6cf9a3ea 100644
--- a/executor/executor_bsd.h
+++ b/executor/executor_bsd.h
@@ -21,6 +21,11 @@ static void os_init(int argc, char** argv, void* data, size_t data_size)
if (mmap(data, data_size, prot, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0) != data)
fail("mmap of data segment failed");
+
+ // Makes sure the file descriptor limit is sufficient to map control pipes.
+ struct rlimit rlim;
+ rlim.rlim_cur = rlim.rlim_max = kMaxFd;
+ setrlimit(RLIMIT_NOFILE, &rlim);
}
static long execute_syscall(const call_t* c, long a[kMaxArgs])