summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-08 14:46:23 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-08 14:46:23 +0000
commit795c5f9b40e9b7ad35368a6a86c9c310a6c9a2d8 (patch)
tree6e2918b083ca5deb96d0620b933538eb89ee5596 /process.c
parentba1c1786d625a9477f029e153a5f10a7e9476319 (diff)
* process.c: don't check the availability of FD_CLOEXEC. It should
be available if fork() is available. * io.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/process.c b/process.c
index d670faf835..491366f2b3 100644
--- a/process.c
+++ b/process.c
@@ -2650,7 +2650,6 @@ rb_exec_atfork(void* arg, char *errmsg, size_t errmsg_buflen)
#endif
#ifdef HAVE_FORK
-#ifdef FD_CLOEXEC
#if SIZEOF_INT == SIZEOF_LONG
#define proc_syswait (VALUE (*)(VALUE))rb_syswait
#else
@@ -2661,7 +2660,6 @@ proc_syswait(VALUE pid)
return Qnil;
}
#endif
-#endif
static int
move_fds_to_avoid_crash(int *fdp, int n, VALUE fds)
@@ -2755,10 +2753,8 @@ rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALU
{
rb_pid_t pid;
int err, state = 0;
-#ifdef FD_CLOEXEC
int ep[2];
VALUE io = Qnil;
-#endif
#define prefork() ( \
rb_io_flush(rb_stdout), \
@@ -2766,7 +2762,6 @@ rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALU
)
prefork();
-#ifdef FD_CLOEXEC
if (chfunc) {
if (status) *status = 0;
if (pipe_nocrash(ep, fds)) return -1;
@@ -2775,7 +2770,6 @@ rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALU
return -1;
}
}
-#endif
for (; before_fork(), (pid = fork()) < 0; prefork()) {
after_fork();
switch (errno) {
@@ -2799,11 +2793,9 @@ rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALU
}
/* fall through */
default:
-#ifdef FD_CLOEXEC
if (chfunc) {
preserving_errno((close(ep[0]), close(ep[1])));
}
-#endif
if (state && !status) rb_jump_tag(state);
return -1;
}
@@ -2816,11 +2808,8 @@ rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALU
arg.arg = charg;
arg.errmsg = errmsg;
arg.buflen = errmsg_buflen;
-#ifdef FD_CLOEXEC
close(ep[0]);
-#endif
if (!(int)rb_protect(chfunc_protect, (VALUE)&arg, &state)) _exit(EXIT_SUCCESS);
-#ifdef FD_CLOEXEC
if (write(ep[1], &state, sizeof(state)) == sizeof(state) && state) {
VALUE errinfo = rb_errinfo();
io = rb_io_fdopen(ep[1], O_WRONLY|O_BINARY, NULL);
@@ -2836,7 +2825,6 @@ rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALU
err = errno;
}
if (!NIL_P(io)) rb_io_close(io);
-#endif
#if EXIT_SUCCESS == 127
_exit(EXIT_FAILURE);
#else
@@ -2845,7 +2833,6 @@ rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALU
}
}
after_fork();
-#ifdef FD_CLOEXEC
if (pid && chfunc) {
ssize_t size;
VALUE exc = Qnil;
@@ -2884,7 +2871,6 @@ rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALU
return -1;
}
}
-#endif
return pid;
}