* internal.h (struct rb_execarg) moved and renamed from
struct rb_exec_arg in intern.h. * include/ruby/intern.h (struct rb_exec_arg): refer Data object which contains struct rb_execarg. * process.c: use struct rb_execarg instead of struct rb_exec_arg except functions declared in intern.h. (rb_exec_arg_addopt): extract a pointer to struct rb_execarg from struct rb_exec_arg. (rb_exec_arg_init): ditto. (rb_exec_arg_fixup): ditto. (rb_run_exec_options_err): ditto. (rb_run_exec_options): ditto. (rb_exec_err): ditto. (rb_exec): ditto. * io.c: use struct rb_execarg instead of struct rb_exec_arg. * ext/pty/pty.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
826f98e688
commit
b60713de73
23
ChangeLog
23
ChangeLog
@ -1,3 +1,26 @@
|
|||||||
|
Wed Jun 20 20:38:23 2012 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* internal.h (struct rb_execarg) moved and renamed from
|
||||||
|
struct rb_exec_arg in intern.h.
|
||||||
|
|
||||||
|
* include/ruby/intern.h (struct rb_exec_arg): refer Data object which
|
||||||
|
contains struct rb_execarg.
|
||||||
|
|
||||||
|
* process.c: use struct rb_execarg instead of struct rb_exec_arg
|
||||||
|
except functions declared in intern.h.
|
||||||
|
(rb_exec_arg_addopt): extract a pointer to struct rb_execarg from
|
||||||
|
struct rb_exec_arg.
|
||||||
|
(rb_exec_arg_init): ditto.
|
||||||
|
(rb_exec_arg_fixup): ditto.
|
||||||
|
(rb_run_exec_options_err): ditto.
|
||||||
|
(rb_run_exec_options): ditto.
|
||||||
|
(rb_exec_err): ditto.
|
||||||
|
(rb_exec): ditto.
|
||||||
|
|
||||||
|
* io.c: use struct rb_execarg instead of struct rb_exec_arg.
|
||||||
|
|
||||||
|
* ext/pty/pty.c: ditto.
|
||||||
|
|
||||||
Wed Jun 20 19:13:25 2012 Tanaka Akira <akr@fsij.org>
|
Wed Jun 20 19:13:25 2012 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* internal.h (rb_execarg_new): declared.
|
* internal.h (rb_execarg_new): declared.
|
||||||
|
@ -79,7 +79,7 @@ struct child_info {
|
|||||||
int master, slave;
|
int master, slave;
|
||||||
char *slavename;
|
char *slavename;
|
||||||
VALUE execarg_obj;
|
VALUE execarg_obj;
|
||||||
struct rb_exec_arg *earg;
|
struct rb_execarg *earg;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -582,23 +582,7 @@ VALUE rb_sym_all_symbols(void);
|
|||||||
void rb_last_status_set(int status, rb_pid_t pid);
|
void rb_last_status_set(int status, rb_pid_t pid);
|
||||||
VALUE rb_last_status_get(void);
|
VALUE rb_last_status_get(void);
|
||||||
struct rb_exec_arg {
|
struct rb_exec_arg {
|
||||||
int use_shell;
|
VALUE execarg_obj;
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
VALUE shell_script;
|
|
||||||
} sh;
|
|
||||||
struct {
|
|
||||||
VALUE command_name;
|
|
||||||
VALUE command_abspath; /* full path string or nil */
|
|
||||||
VALUE argv_str;
|
|
||||||
VALUE argv_buf;
|
|
||||||
} cmd;
|
|
||||||
} invoke;
|
|
||||||
VALUE options;
|
|
||||||
VALUE redirect_fds;
|
|
||||||
VALUE envp_str;
|
|
||||||
VALUE envp_buf;
|
|
||||||
VALUE dup2_tmpbuf;
|
|
||||||
};
|
};
|
||||||
DEPRECATED(int rb_proc_exec_n(int, VALUE*, const char*));
|
DEPRECATED(int rb_proc_exec_n(int, VALUE*, const char*));
|
||||||
int rb_proc_exec(const char*);
|
int rb_proc_exec(const char*);
|
||||||
|
32
internal.h
32
internal.h
@ -159,6 +159,26 @@ st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
|
|||||||
|
|
||||||
/* process.c */
|
/* process.c */
|
||||||
|
|
||||||
|
struct rb_execarg {
|
||||||
|
int use_shell;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
VALUE shell_script;
|
||||||
|
} sh;
|
||||||
|
struct {
|
||||||
|
VALUE command_name;
|
||||||
|
VALUE command_abspath; /* full path string or nil */
|
||||||
|
VALUE argv_str;
|
||||||
|
VALUE argv_buf;
|
||||||
|
} cmd;
|
||||||
|
} invoke;
|
||||||
|
VALUE options;
|
||||||
|
VALUE redirect_fds;
|
||||||
|
VALUE envp_str;
|
||||||
|
VALUE envp_buf;
|
||||||
|
VALUE dup2_tmpbuf;
|
||||||
|
};
|
||||||
|
|
||||||
/* argv_str contains extra two elements.
|
/* argv_str contains extra two elements.
|
||||||
* The beginning one is for /bin/sh used by exec_with_sh.
|
* The beginning one is for /bin/sh used by exec_with_sh.
|
||||||
* The last one for terminating NULL used by execve.
|
* The last one for terminating NULL used by execve.
|
||||||
@ -264,14 +284,14 @@ VALUE rb_thread_call_without_gvl(
|
|||||||
void rb_maygvl_fd_fix_cloexec(int fd);
|
void rb_maygvl_fd_fix_cloexec(int fd);
|
||||||
|
|
||||||
/* process.c */
|
/* process.c */
|
||||||
int rb_exec_async_signal_safe(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen);
|
int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
|
||||||
rb_pid_t rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen);
|
rb_pid_t rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen);
|
||||||
VALUE rb_execarg_new(int argc, VALUE *argv, int accept_shell);
|
VALUE rb_execarg_new(int argc, VALUE *argv, int accept_shell);
|
||||||
struct rb_exec_arg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
|
struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
|
||||||
VALUE rb_execarg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e);
|
VALUE rb_execarg_init(int argc, VALUE *argv, int accept_shell, struct rb_execarg *e);
|
||||||
int rb_execarg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val);
|
int rb_execarg_addopt(struct rb_execarg *e, VALUE key, VALUE val);
|
||||||
void rb_execarg_fixup(struct rb_exec_arg *e);
|
void rb_execarg_fixup(struct rb_execarg *e);
|
||||||
int rb_execarg_run_options(const struct rb_exec_arg *e, struct rb_exec_arg *s, char* errmsg, size_t errmsg_buflen);
|
int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
|
||||||
|
|
||||||
#if defined __GNUC__ && __GNUC__ >= 4
|
#if defined __GNUC__ && __GNUC__ >= 4
|
||||||
#pragma GCC visibility pop
|
#pragma GCC visibility pop
|
||||||
|
10
io.c
10
io.c
@ -5342,7 +5342,7 @@ rb_pipe(int *pipes)
|
|||||||
|
|
||||||
#ifdef HAVE_FORK
|
#ifdef HAVE_FORK
|
||||||
struct popen_arg {
|
struct popen_arg {
|
||||||
struct rb_exec_arg *execp;
|
struct rb_execarg *execp;
|
||||||
int modef;
|
int modef;
|
||||||
int pair[2];
|
int pair[2];
|
||||||
int write_pair[2];
|
int write_pair[2];
|
||||||
@ -5466,7 +5466,7 @@ popen_exec(void *pp, char *errmsg, size_t errmsg_len)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
pipe_open(struct rb_exec_arg *eargp, const char *modestr, int fmode, convconfig_t *convconfig)
|
pipe_open(struct rb_execarg *eargp, const char *modestr, int fmode, convconfig_t *convconfig)
|
||||||
{
|
{
|
||||||
VALUE prog = eargp ? (eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name) : Qfalse ;
|
VALUE prog = eargp ? (eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name) : Qfalse ;
|
||||||
rb_pid_t pid = 0;
|
rb_pid_t pid = 0;
|
||||||
@ -5484,7 +5484,7 @@ pipe_open(struct rb_exec_arg *eargp, const char *modestr, int fmode, convconfig_
|
|||||||
int pair[2], write_pair[2];
|
int pair[2], write_pair[2];
|
||||||
#endif
|
#endif
|
||||||
#if !defined(HAVE_FORK)
|
#if !defined(HAVE_FORK)
|
||||||
struct rb_exec_arg sarg;
|
struct rb_execarg sarg;
|
||||||
#endif
|
#endif
|
||||||
FILE *fp = 0;
|
FILE *fp = 0;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
@ -5727,7 +5727,7 @@ static VALUE
|
|||||||
pipe_open_v(int argc, VALUE *argv, const char *modestr, int fmode, convconfig_t *convconfig)
|
pipe_open_v(int argc, VALUE *argv, const char *modestr, int fmode, convconfig_t *convconfig)
|
||||||
{
|
{
|
||||||
VALUE execarg_obj, ret;
|
VALUE execarg_obj, ret;
|
||||||
struct rb_exec_arg *earg;
|
struct rb_execarg *earg;
|
||||||
execarg_obj = rb_execarg_new(argc, argv, FALSE);
|
execarg_obj = rb_execarg_new(argc, argv, FALSE);
|
||||||
earg = rb_execarg_get(execarg_obj);
|
earg = rb_execarg_get(execarg_obj);
|
||||||
ret = pipe_open(earg, modestr, fmode, convconfig);
|
ret = pipe_open(earg, modestr, fmode, convconfig);
|
||||||
@ -5742,7 +5742,7 @@ pipe_open_s(VALUE prog, const char *modestr, int fmode, convconfig_t *convconfig
|
|||||||
int argc = 1;
|
int argc = 1;
|
||||||
VALUE *argv = &prog;
|
VALUE *argv = &prog;
|
||||||
VALUE execarg_obj, ret;
|
VALUE execarg_obj, ret;
|
||||||
struct rb_exec_arg *earg;
|
struct rb_execarg *earg;
|
||||||
|
|
||||||
if (RSTRING_LEN(prog) == 1 && cmd[0] == '-') {
|
if (RSTRING_LEN(prog) == 1 && cmd[0] == '-') {
|
||||||
#if !defined(HAVE_FORK)
|
#if !defined(HAVE_FORK)
|
||||||
|
66
process.c
66
process.c
@ -1273,7 +1273,7 @@ enum {
|
|||||||
static void
|
static void
|
||||||
mark_exec_arg(void *ptr)
|
mark_exec_arg(void *ptr)
|
||||||
{
|
{
|
||||||
struct rb_exec_arg *earg = ptr;
|
struct rb_execarg *earg = ptr;
|
||||||
if (earg->use_shell)
|
if (earg->use_shell)
|
||||||
rb_gc_mark(earg->invoke.sh.shell_script);
|
rb_gc_mark(earg->invoke.sh.shell_script);
|
||||||
else {
|
else {
|
||||||
@ -1298,7 +1298,7 @@ free_exec_arg(void *ptr)
|
|||||||
static size_t
|
static size_t
|
||||||
memsize_exec_arg(const void *ptr)
|
memsize_exec_arg(const void *ptr)
|
||||||
{
|
{
|
||||||
return ptr ? sizeof(struct rb_exec_arg) : 0;
|
return ptr ? sizeof(struct rb_execarg) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const rb_data_type_t exec_arg_data_type = {
|
static const rb_data_type_t exec_arg_data_type = {
|
||||||
@ -1545,7 +1545,7 @@ static int rlimit_type_by_lname(const char *name);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
rb_execarg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
|
rb_execarg_addopt(struct rb_execarg *e, VALUE key, VALUE val)
|
||||||
{
|
{
|
||||||
VALUE options = e->options;
|
VALUE options = e->options;
|
||||||
ID id;
|
ID id;
|
||||||
@ -1682,7 +1682,7 @@ redirect:
|
|||||||
int
|
int
|
||||||
rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
|
rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
|
||||||
{
|
{
|
||||||
return rb_execarg_addopt(e, key, val);
|
return rb_execarg_addopt(rb_execarg_get(e->execarg_obj), key, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1690,7 +1690,7 @@ check_exec_options_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
|
|||||||
{
|
{
|
||||||
VALUE key = (VALUE)st_key;
|
VALUE key = (VALUE)st_key;
|
||||||
VALUE val = (VALUE)st_val;
|
VALUE val = (VALUE)st_val;
|
||||||
struct rb_exec_arg *e = (struct rb_exec_arg *)arg;
|
struct rb_execarg *e = (struct rb_execarg *)arg;
|
||||||
return rb_execarg_addopt(e, key, val);
|
return rb_execarg_addopt(e, key, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1766,7 +1766,7 @@ check_exec_fds(VALUE options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_check_exec_options(VALUE opthash, struct rb_exec_arg *e)
|
rb_check_exec_options(VALUE opthash, struct rb_execarg *e)
|
||||||
{
|
{
|
||||||
if (RHASH_EMPTY_P(opthash))
|
if (RHASH_EMPTY_P(opthash))
|
||||||
return;
|
return;
|
||||||
@ -1884,12 +1884,12 @@ compare_posix_sh(const void *key, const void *el)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, struct rb_exec_arg *e)
|
rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, struct rb_execarg *e)
|
||||||
{
|
{
|
||||||
VALUE options;
|
VALUE options;
|
||||||
char fbuf[MAXPATHLEN];
|
char fbuf[MAXPATHLEN];
|
||||||
|
|
||||||
MEMZERO(e, struct rb_exec_arg, 1);
|
MEMZERO(e, struct rb_execarg, 1);
|
||||||
options = hide_obj(rb_ary_new());
|
options = hide_obj(rb_ary_new());
|
||||||
e->options = options;
|
e->options = options;
|
||||||
|
|
||||||
@ -2059,22 +2059,22 @@ VALUE
|
|||||||
rb_execarg_new(int argc, VALUE *argv, int accept_shell)
|
rb_execarg_new(int argc, VALUE *argv, int accept_shell)
|
||||||
{
|
{
|
||||||
VALUE execarg_obj;
|
VALUE execarg_obj;
|
||||||
struct rb_exec_arg *e;
|
struct rb_execarg *e;
|
||||||
execarg_obj = TypedData_Make_Struct(rb_cData, struct rb_exec_arg, &exec_arg_data_type, e);
|
execarg_obj = TypedData_Make_Struct(rb_cData, struct rb_execarg, &exec_arg_data_type, e);
|
||||||
hide_obj(execarg_obj);
|
hide_obj(execarg_obj);
|
||||||
rb_execarg_init(argc, argv, accept_shell, e);
|
rb_execarg_init(argc, argv, accept_shell, e);
|
||||||
return execarg_obj;
|
return execarg_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct rb_exec_arg *rb_execarg_get(VALUE execarg_obj)
|
struct rb_execarg *rb_execarg_get(VALUE execarg_obj)
|
||||||
{
|
{
|
||||||
struct rb_exec_arg *e;
|
struct rb_execarg *e;
|
||||||
TypedData_Get_Struct(execarg_obj, struct rb_exec_arg, &exec_arg_data_type, e);
|
TypedData_Get_Struct(execarg_obj, struct rb_execarg, &exec_arg_data_type, e);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_execarg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
|
rb_execarg_init(int argc, VALUE *argv, int accept_shell, struct rb_execarg *e)
|
||||||
{
|
{
|
||||||
VALUE prog;
|
VALUE prog;
|
||||||
VALUE env = Qnil, opthash = Qnil;
|
VALUE env = Qnil, opthash = Qnil;
|
||||||
@ -2086,7 +2086,7 @@ rb_execarg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
|
rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
|
||||||
{
|
{
|
||||||
return rb_execarg_init(argc, argv, accept_shell, e);
|
return rb_execarg_init(argc, argv, accept_shell, rb_execarg_get(e->execarg_obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2108,7 +2108,7 @@ fill_envp_buf_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
|
|||||||
static long run_exec_dup2_tmpbuf_size(long n);
|
static long run_exec_dup2_tmpbuf_size(long n);
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_execarg_fixup(struct rb_exec_arg *e)
|
rb_execarg_fixup(struct rb_execarg *e)
|
||||||
{
|
{
|
||||||
VALUE unsetenv_others, envopts;
|
VALUE unsetenv_others, envopts;
|
||||||
VALUE ary;
|
VALUE ary;
|
||||||
@ -2181,17 +2181,17 @@ rb_execarg_fixup(struct rb_exec_arg *e)
|
|||||||
void
|
void
|
||||||
rb_exec_arg_fixup(struct rb_exec_arg *e)
|
rb_exec_arg_fixup(struct rb_exec_arg *e)
|
||||||
{
|
{
|
||||||
rb_execarg_fixup(e);
|
rb_execarg_fixup(rb_execarg_get(e->execarg_obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_exec_arg_prepare(struct rb_exec_arg *earg, int argc, VALUE *argv)
|
rb_exec_arg_prepare(struct rb_execarg *earg, int argc, VALUE *argv)
|
||||||
{
|
{
|
||||||
rb_execarg_init(argc, argv, TRUE, earg);
|
rb_execarg_init(argc, argv, TRUE, earg);
|
||||||
rb_execarg_fixup(earg);
|
rb_execarg_fixup(earg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rb_exec_without_timer_thread(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen);
|
static int rb_exec_without_timer_thread(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
@ -2248,7 +2248,7 @@ VALUE
|
|||||||
rb_f_exec(int argc, VALUE *argv)
|
rb_f_exec(int argc, VALUE *argv)
|
||||||
{
|
{
|
||||||
VALUE execarg_obj, fail_str;
|
VALUE execarg_obj, fail_str;
|
||||||
struct rb_exec_arg *earg;
|
struct rb_execarg *earg;
|
||||||
#define CHILD_ERRMSG_BUFLEN 80
|
#define CHILD_ERRMSG_BUFLEN 80
|
||||||
char errmsg[CHILD_ERRMSG_BUFLEN] = { '\0' };
|
char errmsg[CHILD_ERRMSG_BUFLEN] = { '\0' };
|
||||||
|
|
||||||
@ -2712,7 +2712,7 @@ save_env(VALUE save)
|
|||||||
|
|
||||||
/* This function should be async-signal-safe when _s_ is NULL. Hopefully it is. */
|
/* This function should be async-signal-safe when _s_ is NULL. Hopefully it is. */
|
||||||
int
|
int
|
||||||
rb_execarg_run_options(const struct rb_exec_arg *e, struct rb_exec_arg *s, char *errmsg, size_t errmsg_buflen)
|
rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char *errmsg, size_t errmsg_buflen)
|
||||||
{
|
{
|
||||||
VALUE options = e->options;
|
VALUE options = e->options;
|
||||||
VALUE soptions = Qnil;
|
VALUE soptions = Qnil;
|
||||||
@ -2840,21 +2840,21 @@ rb_execarg_run_options(const struct rb_exec_arg *e, struct rb_exec_arg *s, char
|
|||||||
int
|
int
|
||||||
rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char *errmsg, size_t errmsg_buflen)
|
rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char *errmsg, size_t errmsg_buflen)
|
||||||
{
|
{
|
||||||
return rb_execarg_run_options(e, s, errmsg, errmsg_buflen);
|
return rb_execarg_run_options(rb_execarg_get(e->execarg_obj), rb_execarg_get(s->execarg_obj), errmsg, errmsg_buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s)
|
rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s)
|
||||||
{
|
{
|
||||||
return rb_execarg_run_options(e, s, NULL, 0);
|
return rb_execarg_run_options(rb_execarg_get(e->execarg_obj), rb_execarg_get(s->execarg_obj), NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function should be async-signal-safe. Hopefully it is. */
|
/* This function should be async-signal-safe. Hopefully it is. */
|
||||||
int
|
int
|
||||||
rb_exec_async_signal_safe(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
|
rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen)
|
||||||
{
|
{
|
||||||
#if !defined(HAVE_FORK)
|
#if !defined(HAVE_FORK)
|
||||||
struct rb_exec_arg sarg, *sargp = &sarg;
|
struct rb_execarg sarg, *sargp = &sarg;
|
||||||
#else
|
#else
|
||||||
# define sargp NULL
|
# define sargp NULL
|
||||||
#endif
|
#endif
|
||||||
@ -2886,7 +2886,7 @@ failure:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rb_exec_without_timer_thread(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
|
rb_exec_without_timer_thread(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
before_exec_non_async_signal_safe(); /* async-signal-safe if forked_child is true */
|
before_exec_non_async_signal_safe(); /* async-signal-safe if forked_child is true */
|
||||||
@ -2898,7 +2898,7 @@ rb_exec_without_timer_thread(const struct rb_exec_arg *e, char *errmsg, size_t e
|
|||||||
int
|
int
|
||||||
rb_exec_err(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
|
rb_exec_err(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
|
||||||
{
|
{
|
||||||
return rb_exec_without_timer_thread(e, errmsg, errmsg_buflen);
|
return rb_exec_without_timer_thread(rb_execarg_get(e->execarg_obj), errmsg, errmsg_buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -2906,7 +2906,7 @@ rb_exec(const struct rb_exec_arg *e)
|
|||||||
{
|
{
|
||||||
#if !defined FD_CLOEXEC && !defined HAVE_SPAWNV
|
#if !defined FD_CLOEXEC && !defined HAVE_SPAWNV
|
||||||
char errmsg[80] = { '\0' };
|
char errmsg[80] = { '\0' };
|
||||||
int ret = rb_exec_without_timer_thread(e, errmsg, sizeof(errmsg));
|
int ret = rb_exec_without_timer_thread(rb_execarg_get(e->execarg_obj), errmsg, sizeof(errmsg));
|
||||||
preserving_errno(
|
preserving_errno(
|
||||||
if (errmsg[0]) {
|
if (errmsg[0]) {
|
||||||
fprintf(stderr, "%s\n", errmsg);
|
fprintf(stderr, "%s\n", errmsg);
|
||||||
@ -2919,7 +2919,7 @@ rb_exec(const struct rb_exec_arg *e)
|
|||||||
);
|
);
|
||||||
return ret;
|
return ret;
|
||||||
#else
|
#else
|
||||||
return rb_exec_without_timer_thread(e, NULL, 0);
|
return rb_exec_without_timer_thread(rb_execarg_get(e->execarg_obj), NULL, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3485,7 +3485,7 @@ rb_syswait(rb_pid_t pid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static rb_pid_t
|
static rb_pid_t
|
||||||
rb_spawn_process(struct rb_exec_arg *earg, char *errmsg, size_t errmsg_buflen)
|
rb_spawn_process(struct rb_execarg *earg, char *errmsg, size_t errmsg_buflen)
|
||||||
{
|
{
|
||||||
rb_pid_t pid;
|
rb_pid_t pid;
|
||||||
#if !USE_SPAWNV
|
#if !USE_SPAWNV
|
||||||
@ -3493,7 +3493,7 @@ rb_spawn_process(struct rb_exec_arg *earg, char *errmsg, size_t errmsg_buflen)
|
|||||||
#endif
|
#endif
|
||||||
#if !defined HAVE_FORK || USE_SPAWNV
|
#if !defined HAVE_FORK || USE_SPAWNV
|
||||||
VALUE prog;
|
VALUE prog;
|
||||||
struct rb_exec_arg sarg;
|
struct rb_execarg sarg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined HAVE_FORK && !USE_SPAWNV
|
#if defined HAVE_FORK && !USE_SPAWNV
|
||||||
@ -3540,7 +3540,7 @@ static rb_pid_t
|
|||||||
rb_spawn_internal(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
|
rb_spawn_internal(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
|
||||||
{
|
{
|
||||||
VALUE execarg_obj;
|
VALUE execarg_obj;
|
||||||
struct rb_exec_arg *earg;
|
struct rb_execarg *earg;
|
||||||
VALUE ret;
|
VALUE ret;
|
||||||
|
|
||||||
execarg_obj = rb_execarg_new(argc, argv, TRUE);
|
execarg_obj = rb_execarg_new(argc, argv, TRUE);
|
||||||
@ -3880,7 +3880,7 @@ rb_f_spawn(int argc, VALUE *argv)
|
|||||||
rb_pid_t pid;
|
rb_pid_t pid;
|
||||||
char errmsg[CHILD_ERRMSG_BUFLEN] = { '\0' };
|
char errmsg[CHILD_ERRMSG_BUFLEN] = { '\0' };
|
||||||
VALUE execarg_obj, fail_str;
|
VALUE execarg_obj, fail_str;
|
||||||
struct rb_exec_arg *earg;
|
struct rb_execarg *earg;
|
||||||
|
|
||||||
execarg_obj = rb_execarg_new(argc, argv, TRUE);
|
execarg_obj = rb_execarg_new(argc, argv, TRUE);
|
||||||
earg = rb_execarg_get(execarg_obj);
|
earg = rb_execarg_get(execarg_obj);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user