mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* configure.in: Use AC_FUNC_FORK.
* io.c: Use HAVE_WORKING_FORK instead of HAVE_FORK. * process.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
50190956c2
commit
93a7bf4b17
4 changed files with 45 additions and 36 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Wed Sep 3 07:50:15 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* configure.in: Use AC_FUNC_FORK.
|
||||||
|
|
||||||
|
* io.c: Use HAVE_WORKING_FORK instead of HAVE_FORK.
|
||||||
|
|
||||||
|
* process.c: Ditto.
|
||||||
|
|
||||||
Wed Sep 3 00:12:44 2014 Tanaka Akira <akr@fsij.org>
|
Wed Sep 3 00:12:44 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* process.c (retry_fork_async_signal_safe): Don't return on in child
|
* process.c (retry_fork_async_signal_safe): Don't return on in child
|
||||||
|
|
|
@ -1962,6 +1962,8 @@ else
|
||||||
AC_LIBOBJ([signbit])
|
AC_LIBOBJ([signbit])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_FUNC_FORK
|
||||||
|
|
||||||
AC_CHECK_FUNCS(__syscall)
|
AC_CHECK_FUNCS(__syscall)
|
||||||
AC_CHECK_FUNCS(_longjmp) # used for AC_ARG_WITH(setjmp-type)
|
AC_CHECK_FUNCS(_longjmp) # used for AC_ARG_WITH(setjmp-type)
|
||||||
AC_CHECK_FUNCS(_setjmp) # used for AC_ARG_WITH(setjmp-type)
|
AC_CHECK_FUNCS(_setjmp) # used for AC_ARG_WITH(setjmp-type)
|
||||||
|
@ -1984,7 +1986,6 @@ AC_CHECK_FUNCS(fchown)
|
||||||
AC_CHECK_FUNCS(fcntl)
|
AC_CHECK_FUNCS(fcntl)
|
||||||
AC_CHECK_FUNCS(fdatasync)
|
AC_CHECK_FUNCS(fdatasync)
|
||||||
AC_CHECK_FUNCS(fmod)
|
AC_CHECK_FUNCS(fmod)
|
||||||
AC_CHECK_FUNCS(fork)
|
|
||||||
AC_CHECK_FUNCS(fsync)
|
AC_CHECK_FUNCS(fsync)
|
||||||
AC_CHECK_FUNCS(ftruncate)
|
AC_CHECK_FUNCS(ftruncate)
|
||||||
AC_CHECK_FUNCS(ftruncate64) # used for Win32 platform
|
AC_CHECK_FUNCS(ftruncate64) # used for Win32 platform
|
||||||
|
@ -2662,7 +2663,7 @@ if test x"$ac_cv_header_ucontext_h" = xyes; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$ac_cv_func_fork" = "yes" -a "$rb_with_pthread" = "yes"; then
|
if test "$ac_cv_func_fork_works" = "yes" -a "$rb_with_pthread" = "yes"; then
|
||||||
AC_CACHE_CHECK([if fork works with pthread], rb_cv_fork_with_pthread,
|
AC_CACHE_CHECK([if fork works with pthread], rb_cv_fork_with_pthread,
|
||||||
[AC_TRY_RUN([
|
[AC_TRY_RUN([
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
38
io.c
38
io.c
|
@ -5665,7 +5665,7 @@ rb_file_open(const char *fname, const char *modestr)
|
||||||
return rb_file_open_internal(io_alloc(rb_cFile), rb_str_new_cstr(fname), modestr);
|
return rb_file_open_internal(io_alloc(rb_cFile), rb_str_new_cstr(fname), modestr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__CYGWIN__) || !defined(HAVE_FORK)
|
#if defined(__CYGWIN__) || !defined(HAVE_WORKING_FORK)
|
||||||
static struct pipe_list {
|
static struct pipe_list {
|
||||||
rb_io_t *fptr;
|
rb_io_t *fptr;
|
||||||
struct pipe_list *next;
|
struct pipe_list *next;
|
||||||
|
@ -5721,7 +5721,7 @@ pipe_atexit(void)
|
||||||
static void
|
static void
|
||||||
pipe_finalize(rb_io_t *fptr, int noraise)
|
pipe_finalize(rb_io_t *fptr, int noraise)
|
||||||
{
|
{
|
||||||
#if !defined(HAVE_FORK) && !defined(_WIN32)
|
#if !defined(HAVE_WORKING_FORK) && !defined(_WIN32)
|
||||||
int status = 0;
|
int status = 0;
|
||||||
if (fptr->stdio_file) {
|
if (fptr->stdio_file) {
|
||||||
status = pclose(fptr->stdio_file);
|
status = pclose(fptr->stdio_file);
|
||||||
|
@ -5773,7 +5773,7 @@ rb_pipe(int *pipes)
|
||||||
#define spawn(mode, cmd) rb_w32_uspawn((mode), (cmd), 0)
|
#define spawn(mode, cmd) rb_w32_uspawn((mode), (cmd), 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
|
#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
|
||||||
struct popen_arg {
|
struct popen_arg {
|
||||||
VALUE execarg_obj;
|
VALUE execarg_obj;
|
||||||
struct rb_execarg *eargp;
|
struct rb_execarg *eargp;
|
||||||
|
@ -5783,7 +5783,7 @@ struct popen_arg {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_FORK
|
#ifdef HAVE_WORKING_FORK
|
||||||
static void
|
static void
|
||||||
popen_redirect(struct popen_arg *p)
|
popen_redirect(struct popen_arg *p)
|
||||||
{
|
{
|
||||||
|
@ -5918,11 +5918,11 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
|
||||||
VALUE port;
|
VALUE port;
|
||||||
rb_io_t *write_fptr;
|
rb_io_t *write_fptr;
|
||||||
VALUE write_port;
|
VALUE write_port;
|
||||||
#if defined(HAVE_FORK)
|
#if defined(HAVE_WORKING_FORK)
|
||||||
int status;
|
int status;
|
||||||
char errmsg[80] = { '\0' };
|
char errmsg[80] = { '\0' };
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
|
#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
|
||||||
int state;
|
int state;
|
||||||
struct popen_arg arg;
|
struct popen_arg arg;
|
||||||
int e = 0;
|
int e = 0;
|
||||||
|
@ -5937,20 +5937,20 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
|
||||||
spawnv(P_NOWAIT, (cmd), (args)) : \
|
spawnv(P_NOWAIT, (cmd), (args)) : \
|
||||||
spawn(P_NOWAIT, (cmd)))
|
spawn(P_NOWAIT, (cmd)))
|
||||||
# endif
|
# endif
|
||||||
# if !defined(HAVE_FORK)
|
# if !defined(HAVE_WORKING_FORK)
|
||||||
char **args = NULL;
|
char **args = NULL;
|
||||||
# if defined(HAVE_SPAWNVE)
|
# if defined(HAVE_SPAWNVE)
|
||||||
char **envp = NULL;
|
char **envp = NULL;
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(HAVE_FORK)
|
#if !defined(HAVE_WORKING_FORK)
|
||||||
struct rb_execarg sarg, *sargp = &sarg;
|
struct rb_execarg sarg, *sargp = &sarg;
|
||||||
#endif
|
#endif
|
||||||
FILE *fp = 0;
|
FILE *fp = 0;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
int write_fd = -1;
|
int write_fd = -1;
|
||||||
#if !defined(HAVE_FORK)
|
#if !defined(HAVE_WORKING_FORK)
|
||||||
const char *cmd = 0;
|
const char *cmd = 0;
|
||||||
#if !defined(HAVE_SPAWNV)
|
#if !defined(HAVE_SPAWNV)
|
||||||
int argc;
|
int argc;
|
||||||
|
@ -5961,13 +5961,13 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
|
||||||
cmd = StringValueCStr(prog);
|
cmd = StringValueCStr(prog);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
|
#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
|
||||||
arg.execarg_obj = execarg_obj;
|
arg.execarg_obj = execarg_obj;
|
||||||
arg.eargp = eargp;
|
arg.eargp = eargp;
|
||||||
arg.modef = fmode;
|
arg.modef = fmode;
|
||||||
arg.pair[0] = arg.pair[1] = -1;
|
arg.pair[0] = arg.pair[1] = -1;
|
||||||
arg.write_pair[0] = arg.write_pair[1] = -1;
|
arg.write_pair[0] = arg.write_pair[1] = -1;
|
||||||
# if !defined(HAVE_FORK)
|
# if !defined(HAVE_WORKING_FORK)
|
||||||
if (eargp && !eargp->use_shell) {
|
if (eargp && !eargp->use_shell) {
|
||||||
args = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
|
args = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
|
||||||
}
|
}
|
||||||
|
@ -6013,7 +6013,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
|
||||||
rb_jump_tag(state);
|
rb_jump_tag(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
# if defined(HAVE_FORK)
|
# if defined(HAVE_WORKING_FORK)
|
||||||
pid = rb_fork_async_signal_safe(&status, popen_exec, &arg, arg.eargp->redirect_fds, errmsg, sizeof(errmsg));
|
pid = rb_fork_async_signal_safe(&status, popen_exec, &arg, arg.eargp->redirect_fds, errmsg, sizeof(errmsg));
|
||||||
# else
|
# else
|
||||||
rb_execarg_run_options(eargp, sargp, NULL, 0);
|
rb_execarg_run_options(eargp, sargp, NULL, 0);
|
||||||
|
@ -6037,7 +6037,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# if defined(HAVE_FORK)
|
# if defined(HAVE_WORKING_FORK)
|
||||||
pid = rb_fork_ruby(&status);
|
pid = rb_fork_ruby(&status);
|
||||||
if (pid == 0) { /* child */
|
if (pid == 0) { /* child */
|
||||||
rb_thread_atfork();
|
rb_thread_atfork();
|
||||||
|
@ -6053,7 +6053,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
|
||||||
|
|
||||||
/* parent */
|
/* parent */
|
||||||
if (pid == -1) {
|
if (pid == -1) {
|
||||||
# if defined(HAVE_FORK)
|
# if defined(HAVE_WORKING_FORK)
|
||||||
e = errno;
|
e = errno;
|
||||||
# endif
|
# endif
|
||||||
close(arg.pair[0]);
|
close(arg.pair[0]);
|
||||||
|
@ -6063,7 +6063,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
|
||||||
close(arg.write_pair[1]);
|
close(arg.write_pair[1]);
|
||||||
}
|
}
|
||||||
errno = e;
|
errno = e;
|
||||||
# if defined(HAVE_FORK)
|
# if defined(HAVE_WORKING_FORK)
|
||||||
if (errmsg[0])
|
if (errmsg[0])
|
||||||
rb_sys_fail(errmsg);
|
rb_sys_fail(errmsg);
|
||||||
# endif
|
# endif
|
||||||
|
@ -6134,7 +6134,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
|
||||||
rb_ivar_set(port, rb_intern("@tied_io_for_writing"), write_port);
|
rb_ivar_set(port, rb_intern("@tied_io_for_writing"), write_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (__CYGWIN__) || !defined(HAVE_FORK)
|
#if defined (__CYGWIN__) || !defined(HAVE_WORKING_FORK)
|
||||||
fptr->finalize = pipe_finalize;
|
fptr->finalize = pipe_finalize;
|
||||||
pipe_add_fptr(fptr);
|
pipe_add_fptr(fptr);
|
||||||
#endif
|
#endif
|
||||||
|
@ -6145,7 +6145,7 @@ static int
|
||||||
is_popen_fork(VALUE prog)
|
is_popen_fork(VALUE prog)
|
||||||
{
|
{
|
||||||
if (RSTRING_LEN(prog) == 1 && RSTRING_PTR(prog)[0] == '-') {
|
if (RSTRING_LEN(prog) == 1 && RSTRING_PTR(prog)[0] == '-') {
|
||||||
#if !defined(HAVE_FORK)
|
#if !defined(HAVE_WORKING_FORK)
|
||||||
rb_raise(rb_eNotImpError,
|
rb_raise(rb_eNotImpError,
|
||||||
"fork() function is unimplemented on this machine");
|
"fork() function is unimplemented on this machine");
|
||||||
#else
|
#else
|
||||||
|
@ -6669,7 +6669,7 @@ io_reopen(VALUE io, VALUE nfile)
|
||||||
if (RTEST(orig->pathv)) fptr->pathv = orig->pathv;
|
if (RTEST(orig->pathv)) fptr->pathv = orig->pathv;
|
||||||
else if (!IS_PREP_STDIO(fptr)) fptr->pathv = Qnil;
|
else if (!IS_PREP_STDIO(fptr)) fptr->pathv = Qnil;
|
||||||
fptr->finalize = orig->finalize;
|
fptr->finalize = orig->finalize;
|
||||||
#if defined (__CYGWIN__) || !defined(HAVE_FORK)
|
#if defined (__CYGWIN__) || !defined(HAVE_WORKING_FORK)
|
||||||
if (fptr->finalize == pipe_finalize)
|
if (fptr->finalize == pipe_finalize)
|
||||||
pipe_add_fptr(fptr);
|
pipe_add_fptr(fptr);
|
||||||
#endif
|
#endif
|
||||||
|
@ -6837,7 +6837,7 @@ rb_io_init_copy(VALUE dest, VALUE io)
|
||||||
fptr->lineno = orig->lineno;
|
fptr->lineno = orig->lineno;
|
||||||
if (!NIL_P(orig->pathv)) fptr->pathv = orig->pathv;
|
if (!NIL_P(orig->pathv)) fptr->pathv = orig->pathv;
|
||||||
fptr->finalize = orig->finalize;
|
fptr->finalize = orig->finalize;
|
||||||
#if defined (__CYGWIN__) || !defined(HAVE_FORK)
|
#if defined (__CYGWIN__) || !defined(HAVE_WORKING_FORK)
|
||||||
if (fptr->finalize == pipe_finalize)
|
if (fptr->finalize == pipe_finalize)
|
||||||
pipe_add_fptr(fptr);
|
pipe_add_fptr(fptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
30
process.c
30
process.c
|
@ -1181,7 +1181,7 @@ security(const char *str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_FORK) && !defined(__native_client__)
|
#if defined(HAVE_WORKING_FORK) && !defined(__native_client__)
|
||||||
|
|
||||||
/* try_with_sh and exec_with_sh should be async-signal-safe. Actually it is.*/
|
/* try_with_sh and exec_with_sh should be async-signal-safe. Actually it is.*/
|
||||||
#define try_with_sh(prog, argv, envp) ((saved_errno == ENOEXEC) ? exec_with_sh((prog), (argv), (envp)) : (void)0)
|
#define try_with_sh(prog, argv, envp) ((saved_errno == ENOEXEC) ? exec_with_sh((prog), (argv), (envp)) : (void)0)
|
||||||
|
@ -1382,7 +1382,7 @@ export_dup(VALUE str)
|
||||||
# define EXPORT_DUP(str) rb_str_dup(str)
|
# define EXPORT_DUP(str) rb_str_dup(str)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_FORK) && defined(HAVE_SPAWNV)
|
#if !defined(HAVE_WORKING_FORK) && defined(HAVE_SPAWNV)
|
||||||
# define USE_SPAWNV 1
|
# define USE_SPAWNV 1
|
||||||
#else
|
#else
|
||||||
# define USE_SPAWNV 0
|
# define USE_SPAWNV 0
|
||||||
|
@ -2883,7 +2883,7 @@ run_exec_rlimit(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_FORK)
|
#if !defined(HAVE_WORKING_FORK)
|
||||||
static VALUE
|
static VALUE
|
||||||
save_env_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
|
save_env_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
|
||||||
{
|
{
|
||||||
|
@ -2937,7 +2937,7 @@ rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_FORK)
|
#if !defined(HAVE_WORKING_FORK)
|
||||||
if (eargp->unsetenv_others_given && eargp->unsetenv_others_do) {
|
if (eargp->unsetenv_others_given && eargp->unsetenv_others_do) {
|
||||||
save_env(sargp);
|
save_env(sargp);
|
||||||
rb_env_clear();
|
rb_env_clear();
|
||||||
|
@ -2984,7 +2984,7 @@ rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_FORK
|
#ifdef HAVE_WORKING_FORK
|
||||||
if (!eargp->close_others_given || eargp->close_others_do) {
|
if (!eargp->close_others_given || eargp->close_others_do) {
|
||||||
rb_close_before_exec(3, eargp->close_others_maxhint, eargp->redirect_fds); /* async-signal-safe */
|
rb_close_before_exec(3, eargp->close_others_maxhint, eargp->redirect_fds); /* async-signal-safe */
|
||||||
}
|
}
|
||||||
|
@ -3049,7 +3049,7 @@ rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp,
|
||||||
int
|
int
|
||||||
rb_exec_async_signal_safe(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
|
rb_exec_async_signal_safe(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
|
||||||
{
|
{
|
||||||
#if !defined(HAVE_FORK)
|
#if !defined(HAVE_WORKING_FORK)
|
||||||
struct rb_execarg sarg, *const sargp = &sarg;
|
struct rb_execarg sarg, *const sargp = &sarg;
|
||||||
#else
|
#else
|
||||||
struct rb_execarg *const sargp = NULL;
|
struct rb_execarg *const sargp = NULL;
|
||||||
|
@ -3070,7 +3070,7 @@ rb_exec_async_signal_safe(const struct rb_execarg *eargp, char *errmsg, size_t e
|
||||||
abspath = RSTRING_PTR(eargp->invoke.cmd.command_abspath);
|
abspath = RSTRING_PTR(eargp->invoke.cmd.command_abspath);
|
||||||
proc_exec_cmd(abspath, eargp->invoke.cmd.argv_str, eargp->envp_str); /* async-signal-safe */
|
proc_exec_cmd(abspath, eargp->invoke.cmd.argv_str, eargp->envp_str); /* async-signal-safe */
|
||||||
}
|
}
|
||||||
#if !defined(HAVE_FORK)
|
#if !defined(HAVE_WORKING_FORK)
|
||||||
preserving_errno(rb_execarg_run_options(sargp, NULL, errmsg, errmsg_buflen));
|
preserving_errno(rb_execarg_run_options(sargp, NULL, errmsg, errmsg_buflen));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3091,7 +3091,7 @@ rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_FORK
|
#ifdef HAVE_WORKING_FORK
|
||||||
/* This function should be async-signal-safe. Hopefully it is. */
|
/* This function should be async-signal-safe. Hopefully it is. */
|
||||||
static int
|
static int
|
||||||
rb_exec_atfork(void* arg, char *errmsg, size_t errmsg_buflen)
|
rb_exec_atfork(void* arg, char *errmsg, size_t errmsg_buflen)
|
||||||
|
@ -3100,7 +3100,7 @@ rb_exec_atfork(void* arg, char *errmsg, size_t errmsg_buflen)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_FORK
|
#ifdef HAVE_WORKING_FORK
|
||||||
#if SIZEOF_INT == SIZEOF_LONG
|
#if SIZEOF_INT == SIZEOF_LONG
|
||||||
#define proc_syswait (VALUE (*)(VALUE))rb_syswait
|
#define proc_syswait (VALUE (*)(VALUE))rb_syswait
|
||||||
#else
|
#else
|
||||||
|
@ -3387,7 +3387,7 @@ rb_fork_ruby(int *status)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
|
#if defined(HAVE_WORKING_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* Kernel.fork [{ block }] -> fixnum or nil
|
* Kernel.fork [{ block }] -> fixnum or nil
|
||||||
|
@ -3617,12 +3617,12 @@ rb_spawn_process(struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
|
||||||
#if !USE_SPAWNV
|
#if !USE_SPAWNV
|
||||||
int status;
|
int status;
|
||||||
#endif
|
#endif
|
||||||
#if !defined HAVE_FORK || USE_SPAWNV
|
#if !defined HAVE_WORKING_FORK || USE_SPAWNV
|
||||||
VALUE prog;
|
VALUE prog;
|
||||||
struct rb_execarg sarg;
|
struct rb_execarg sarg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined HAVE_FORK && !USE_SPAWNV
|
#if defined HAVE_WORKING_FORK && !USE_SPAWNV
|
||||||
pid = rb_fork_async_signal_safe(&status, rb_exec_atfork, eargp, eargp->redirect_fds, errmsg, errmsg_buflen);
|
pid = rb_fork_async_signal_safe(&status, rb_exec_atfork, eargp, eargp->redirect_fds, errmsg, errmsg_buflen);
|
||||||
#else
|
#else
|
||||||
prog = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
|
prog = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
|
||||||
|
@ -3737,7 +3737,7 @@ rb_f_system(int argc, VALUE *argv)
|
||||||
chfunc = signal(SIGCHLD, SIG_DFL);
|
chfunc = signal(SIGCHLD, SIG_DFL);
|
||||||
#endif
|
#endif
|
||||||
pid = rb_spawn_internal(argc, argv, NULL, 0);
|
pid = rb_spawn_internal(argc, argv, NULL, 0);
|
||||||
#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
|
#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
|
||||||
if (pid > 0) {
|
if (pid > 0) {
|
||||||
int ret, status;
|
int ret, status;
|
||||||
ret = rb_waitpid(pid, &status, 0);
|
ret = rb_waitpid(pid, &status, 0);
|
||||||
|
@ -4045,7 +4045,7 @@ rb_f_spawn(int argc, VALUE *argv)
|
||||||
}
|
}
|
||||||
rb_sys_fail(prog);
|
rb_sys_fail(prog);
|
||||||
}
|
}
|
||||||
#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
|
#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
|
||||||
return PIDT2NUM(pid);
|
return PIDT2NUM(pid);
|
||||||
#else
|
#else
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
@ -5681,7 +5681,7 @@ proc_setmaxgroups(VALUE obj, VALUE val)
|
||||||
#define proc_setmaxgroups rb_f_notimplement
|
#define proc_setmaxgroups rb_f_notimplement
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_DAEMON) || (defined(HAVE_FORK) && defined(HAVE_SETSID))
|
#if defined(HAVE_DAEMON) || (defined(HAVE_WORKING_FORK) && defined(HAVE_SETSID))
|
||||||
static int rb_daemon(int nochdir, int noclose);
|
static int rb_daemon(int nochdir, int noclose);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue