Ruby
2.4.2p198(2017-09-14revision59899)
|
#include "internal.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "vm_core.h"
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <time.h>
#include <ctype.h>
#include "ruby/st.h"
#include <sys/stat.h>
#include "dln.h"
Go to the source code of this file.
Data Structures | |
struct | waitpid_arg |
struct | string_part |
struct | open_struct |
struct | run_exec_dup2_fd_pair |
struct | spawn_args |
struct | timetick |
Typedefs | |
typedef unsigned int | unsigned_clock_t |
typedef void(* | sig_t) (int) |
typedef long | timetick_int_t |
Functions | |
static void | check_uid_switch (void) |
static void | check_gid_switch (void) |
static int | close_unless_reserved (int fd) |
static VALUE | get_pid (void) |
static VALUE | get_ppid (void) |
VALUE | rb_last_status_get (void) |
void | rb_last_status_set (int status, rb_pid_t pid) |
void | rb_last_status_clear (void) |
static VALUE | pst_to_i (VALUE st) |
static VALUE | pst_pid (VALUE st) |
static void | pst_message (VALUE str, rb_pid_t pid, int status) |
static VALUE | pst_to_s (VALUE st) |
static VALUE | pst_inspect (VALUE st) |
static VALUE | pst_equal (VALUE st1, VALUE st2) |
static VALUE | pst_bitand (VALUE st1, VALUE st2) |
static VALUE | pst_rshift (VALUE st1, VALUE st2) |
static VALUE | pst_wifstopped (VALUE st) |
static VALUE | pst_wstopsig (VALUE st) |
static VALUE | pst_wifsignaled (VALUE st) |
static VALUE | pst_wtermsig (VALUE st) |
static VALUE | pst_wifexited (VALUE st) |
static VALUE | pst_wexitstatus (VALUE st) |
static VALUE | pst_success_p (VALUE st) |
static VALUE | pst_wcoredump (VALUE st) |
static rb_pid_t | do_waitpid (rb_pid_t pid, int *st, int flags) |
static void * | rb_waitpid_blocking (void *data) |
static rb_pid_t | do_waitpid_nonblocking (rb_pid_t pid, int *st, int flags) |
rb_pid_t | rb_waitpid (rb_pid_t pid, int *st, int flags) |
static VALUE | proc_wait (int argc, VALUE *argv) |
static VALUE | proc_wait2 (int argc, VALUE *argv) |
static VALUE | proc_waitall (void) |
static VALUE | detach_process_pid (VALUE thread) |
static VALUE | detach_process_watcher (void *arg) |
VALUE | rb_detach_process (rb_pid_t pid) |
static VALUE | proc_detach (VALUE obj, VALUE pid) |
static void | before_exec_async_signal_safe (void) |
static void | before_exec_non_async_signal_safe (void) |
static void | before_exec (void) |
static void | after_exec_async_signal_safe (void) |
static void | after_exec_non_async_signal_safe (void) |
static void | after_exec (void) |
static void | security (const char *str) |
static int | proc_exec_cmd (const char *prog, VALUE argv_str, VALUE envp_str) |
static int | proc_exec_sh (const char *str, VALUE envp_str) |
int | rb_proc_exec (const char *str) |
static void | mark_exec_arg (void *ptr) |
static size_t | memsize_exec_arg (const void *ptr) |
static VALUE | hide_obj (VALUE obj) |
static VALUE | check_exec_redirect_fd (VALUE v, int iskey) |
static VALUE | check_exec_redirect1 (VALUE ary, VALUE key, VALUE param) |
static void | check_exec_redirect (VALUE key, VALUE val, struct rb_execarg *eargp) |
int | rb_execarg_addopt (VALUE execarg_obj, VALUE key, VALUE val) |
static int | check_exec_options_i (st_data_t st_key, st_data_t st_val, st_data_t arg) |
static int | check_exec_options_i_extract (st_data_t st_key, st_data_t st_val, st_data_t arg) |
static int | check_exec_fds_1 (struct rb_execarg *eargp, VALUE h, int maxhint, VALUE ary) |
static VALUE | check_exec_fds (struct rb_execarg *eargp) |
static void | rb_check_exec_options (VALUE opthash, VALUE execarg_obj) |
VALUE | rb_execarg_extract_options (VALUE execarg_obj, VALUE opthash) |
static int | check_exec_env_i (st_data_t st_key, st_data_t st_val, st_data_t arg) |
static VALUE | rb_check_exec_env (VALUE hash, VALUE *path) |
static VALUE | rb_check_argv (int argc, VALUE *argv) |
static VALUE | check_hash (VALUE obj) |
static VALUE | rb_exec_getargs (int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, VALUE *opthash_ret) |
static int | compare_posix_sh (const void *key, const void *el) |
static void | rb_exec_fillarg (VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, VALUE execarg_obj) |
VALUE | rb_execarg_new (int argc, const VALUE *argv, int accept_shell) |
struct rb_execarg * | rb_execarg_get (VALUE execarg_obj) |
VALUE | rb_execarg_init (int argc, const VALUE *orig_argv, int accept_shell, VALUE execarg_obj) |
void | rb_execarg_setenv (VALUE execarg_obj, VALUE env) |
static int | 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 void * | open_func (void *ptr) |
static VALUE | rb_execarg_parent_start1 (VALUE execarg_obj) |
void | rb_execarg_parent_start (VALUE execarg_obj) |
static VALUE | execarg_parent_end (VALUE execarg_obj) |
void | rb_execarg_parent_end (VALUE execarg_obj) |
static void | rb_exec_fail (struct rb_execarg *eargp, int err, const char *errmsg) |
VALUE | rb_f_exec (int argc, const VALUE *argv) |
static int | fd_get_cloexec (int fd, char *errmsg, size_t errmsg_buflen) |
static int | fd_set_cloexec (int fd, char *errmsg, size_t errmsg_buflen) |
static int | fd_clear_cloexec (int fd, char *errmsg, size_t errmsg_buflen) |
static int | save_redirect_fd (int fd, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen) |
static int | intcmp (const void *a, const void *b) |
static int | intrcmp (const void *a, const void *b) |
static int | run_exec_dup2 (VALUE ary, VALUE tmpbuf, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen) |
static int | run_exec_close (VALUE ary, char *errmsg, size_t errmsg_buflen) |
static int | run_exec_dup2_child (VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen) |
static VALUE | save_env_i (RB_BLOCK_CALL_FUNC_ARGLIST(i, ary)) |
static void | save_env (struct rb_execarg *sargp) |
int | rb_execarg_run_options (const struct rb_execarg *eargp, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen) |
int | rb_exec_async_signal_safe (const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen) |
static int | exit_status_code (VALUE status) |
static VALUE | rb_f_exit_bang (int argc, VALUE *argv, VALUE obj) |
void | rb_exit (int status) |
VALUE | rb_f_exit (int argc, const VALUE *argv) |
VALUE | rb_f_abort (int argc, const VALUE *argv) |
void | rb_syswait (rb_pid_t pid) |
char * | rb_execarg_commandline (const struct rb_execarg *eargp, VALUE *prog) |
static rb_pid_t | rb_spawn_process (struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen) |
static VALUE | do_spawn_process (VALUE arg) |
static rb_pid_t | rb_execarg_spawn (VALUE execarg_obj, char *errmsg, size_t errmsg_buflen) |
static rb_pid_t | rb_spawn_internal (int argc, const VALUE *argv, char *errmsg, size_t errmsg_buflen) |
rb_pid_t | rb_spawn_err (int argc, const VALUE *argv, char *errmsg, size_t errmsg_buflen) |
rb_pid_t | rb_spawn (int argc, const VALUE *argv) |
static VALUE | rb_f_system (int argc, VALUE *argv) |
static VALUE | rb_f_spawn (int argc, VALUE *argv) |
static VALUE | rb_f_sleep (int argc, VALUE *argv) |
static VALUE | proc_getuid (VALUE obj) |
static VALUE | p_uid_change_privilege (VALUE obj, VALUE id) |
static VALUE | proc_getgid (VALUE obj) |
static VALUE | p_gid_change_privilege (VALUE obj, VALUE id) |
static VALUE | proc_geteuid (VALUE obj) |
static rb_uid_t | rb_seteuid_core (rb_uid_t euid) |
static VALUE | p_uid_grant_privilege (VALUE obj, VALUE id) |
static VALUE | proc_getegid (VALUE obj) |
static rb_gid_t | rb_setegid_core (rb_gid_t egid) |
static VALUE | p_gid_grant_privilege (VALUE obj, VALUE id) |
static VALUE | p_uid_exchangeable (void) |
static VALUE | p_uid_exchange (VALUE obj) |
static VALUE | p_gid_exchangeable (void) |
static VALUE | p_gid_exchange (VALUE obj) |
static VALUE | p_uid_have_saved_id (void) |
static VALUE | p_uid_sw_ensure (VALUE obj) |
static VALUE | p_uid_switch (VALUE obj) |
static VALUE | p_gid_have_saved_id (void) |
static VALUE | p_gid_sw_ensure (VALUE obj) |
static VALUE | p_gid_switch (VALUE obj) |
CONSTFUNC (static timetick_int_t gcd_timetick_int(timetick_int_t, timetick_int_t)) | |
static timetick_int_t | gcd_timetick_int (timetick_int_t a, timetick_int_t b) |
static void | reduce_fraction (timetick_int_t *np, timetick_int_t *dp) |
static void | reduce_factors (timetick_int_t *numerators, int num_numerators, timetick_int_t *denominators, int num_denominators) |
static VALUE | timetick2dblnum (struct timetick *ttp, timetick_int_t *numerators, int num_numerators, timetick_int_t *denominators, int num_denominators) |
static VALUE | timetick2dblnum_reciprocal (struct timetick *ttp, timetick_int_t *numerators, int num_numerators, timetick_int_t *denominators, int num_denominators) |
static VALUE | timetick2integer (struct timetick *ttp, timetick_int_t *numerators, int num_numerators, timetick_int_t *denominators, int num_denominators) |
static VALUE | make_clock_result (struct timetick *ttp, timetick_int_t *numerators, int num_numerators, timetick_int_t *denominators, int num_denominators, VALUE unit) |
VALUE | rb_clock_gettime (int argc, VALUE *argv) |
VALUE | rb_clock_getres (int argc, VALUE *argv) |
void | InitVM_process (void) |
void | Init_process (void) |
Variables | |
static ID | id_in |
static ID | id_out |
static ID | id_err |
static ID | id_pid |
static ID | id_uid |
static ID | id_gid |
static ID | id_close |
static ID | id_child |
static ID | id_unsetenv_others |
static ID | id_chdir |
static ID | id_umask |
static ID | id_close_others |
static ID | id_ENV |
static ID | id_nanosecond |
static ID | id_microsecond |
static ID | id_millisecond |
static ID | id_second |
static ID | id_float_microsecond |
static ID | id_float_millisecond |
static ID | id_float_second |
static ID | id_GETTIMEOFDAY_BASED_CLOCK_REALTIME |
static ID | id_TIME_BASED_CLOCK_REALTIME |
static ID | id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID |
static ID | id_hertz |
ID | ruby_static_id_status |
static VALUE | rb_cProcessStatus |
static VALUE | rb_cWaiter |
static const rb_data_type_t | exec_arg_data_type |
static int | under_uid_switch = 0 |
static int | under_gid_switch = 0 |
static rb_uid_t | SAVED_USER_ID = -1 |
static rb_gid_t | SAVED_GROUP_ID = -1 |
VALUE | rb_mProcess |
VALUE | rb_mProcUID |
VALUE | rb_mProcGID |
VALUE | rb_mProcID_Syscall |
#define after_fork_ruby | ( | ) | (rb_threadptr_pending_interrupt_clear(GET_THREAD()), after_exec()) |
Definition at line 1208 of file process.c.
Referenced by rb_exec_async_signal_safe().
#define ALWAYS_NEED_ENVP 0 |
Definition at line 293 of file process.c.
Referenced by rb_execarg_parent_start1().
#define before_fork_ruby | ( | ) | before_exec() |
Definition at line 1207 of file process.c.
Referenced by rb_exec_async_signal_safe().
#define CHILD_ERRMSG_BUFLEN 80 |
Referenced by rb_f_exec(), and rb_f_spawn().
#define DIV | ( | n, | |
d | |||
) | ((n)<0 ? NDIV((n),(d)) : (n)/(d)) |
Definition at line 7046 of file process.c.
Referenced by timetick2integer().
#define ENVMATCH | ( | n1, | |
n2 | |||
) | (strcmp((n1), (n2)) == 0) |
Definition at line 1942 of file process.c.
Referenced by check_exec_env_i().
#define ERRMSG | ( | str | ) | do { if (errmsg && 0 < errmsg_buflen) strlcpy(errmsg, (str), errmsg_buflen); } while (0) |
Definition at line 2621 of file process.c.
Referenced by fd_clear_cloexec(), fd_get_cloexec(), fd_set_cloexec(), rb_exec_async_signal_safe(), rb_execarg_run_options(), run_exec_close(), run_exec_dup2(), run_exec_dup2_child(), and save_redirect_fd().
#define EXIT_FAILURE 1 |
Definition at line 43 of file process.c.
Referenced by exit_status_code(), rb_exec_async_signal_safe(), rb_f_abort(), and rb_f_exit_bang().
#define EXIT_SUCCESS 0 |
Definition at line 40 of file process.c.
Referenced by exit_status_code(), pst_success_p(), rb_exec_async_signal_safe(), rb_f_exit(), and rb_f_system().
#define EXPORT_DUP | ( | str | ) | rb_str_dup(str) |
Definition at line 1384 of file process.c.
Referenced by check_exec_redirect(), and rb_execarg_addopt().
#define EXPORT_STR | ( | str | ) | (str) |
Definition at line 1383 of file process.c.
Referenced by check_exec_env_i(), and rb_exec_fillarg().
#define id_status ruby_static_id_status |
Definition at line 285 of file process.c.
Referenced by pst_to_i(), and rb_last_status_set().
#define MAXPATHLEN 1024 |
Definition at line 59 of file process.c.
Referenced by proc_exec_sh(), and rb_exec_fillarg().
Definition at line 242 of file process.c.
Referenced by check_gid_switch(), p_gid_change_privilege(), p_gid_grant_privilege(), p_uid_change_privilege(), proc_getegid(), proc_getgid(), and rb_execarg_addopt().
Definition at line 199 of file process.c.
Referenced by check_gid_switch(), p_uid_change_privilege(), p_uid_grant_privilege(), proc_geteuid(), proc_getuid(), and rb_execarg_addopt().
#define p_gid_from_name p_gid_from_name |
Definition at line 245 of file process.c.
Referenced by check_gid_switch(), and InitVM_process().
#define p_gid_from_name rb_f_notimplement |
#define P_NOWAIT _P_NOWAIT |
Definition at line 1393 of file process.c.
Referenced by check_spawn_mode().
#define p_sys_issetugid rb_f_notimplement |
Definition at line 5725 of file process.c.
Referenced by InitVM_process().
#define p_sys_setegid rb_f_notimplement |
Definition at line 5639 of file process.c.
Referenced by InitVM_process().
#define p_sys_seteuid rb_f_notimplement |
Definition at line 5259 of file process.c.
Referenced by InitVM_process().
#define p_sys_setgid rb_f_notimplement |
Definition at line 5595 of file process.c.
Referenced by InitVM_process(), and p_uid_change_privilege().
#define p_sys_setregid rb_f_notimplement |
Definition at line 5668 of file process.c.
Referenced by InitVM_process().
#define p_sys_setresgid rb_f_notimplement |
Definition at line 5697 of file process.c.
Referenced by InitVM_process().
#define p_sys_setresuid rb_f_notimplement |
Definition at line 5318 of file process.c.
Referenced by InitVM_process().
#define p_sys_setreuid rb_f_notimplement |
Definition at line 5288 of file process.c.
Referenced by InitVM_process().
#define p_sys_setrgid rb_f_notimplement |
Definition at line 5617 of file process.c.
Referenced by InitVM_process().
#define p_sys_setruid rb_f_notimplement |
Definition at line 5237 of file process.c.
Referenced by InitVM_process().
#define p_sys_setuid rb_f_notimplement |
Definition at line 5215 of file process.c.
Referenced by check_gid_switch(), and InitVM_process().
#define p_uid_from_name p_uid_from_name |
Definition at line 202 of file process.c.
Referenced by check_gid_switch(), and InitVM_process().
#define p_uid_from_name rb_f_notimplement |
#define parent_redirect_close | ( | fd | ) | close_unless_reserved(fd) |
Definition at line 403 of file process.c.
Referenced by close_unless_reserved(), and execarg_parent_end().
#define parent_redirect_open | ( | pathname, | |
flags, | |||
perm | |||
) | rb_cloexec_open((pathname), (flags), (perm)) |
Definition at line 402 of file process.c.
Referenced by close_unless_reserved(), and open_func().
#define preserving_errno | ( | stmts | ) | do {int saved_errno = errno; stmts; errno = saved_errno;} while (0) |
Definition at line 153 of file process.c.
Referenced by proc_exec_cmd(), rb_exec_async_signal_safe(), and rb_proc_exec().
#define proc_daemon rb_f_notimplement |
Definition at line 6082 of file process.c.
Referenced by InitVM_process().
#define proc_getgroups rb_f_notimplement |
Definition at line 5873 of file process.c.
Referenced by InitVM_process().
#define proc_getmaxgroups rb_f_notimplement |
Definition at line 5973 of file process.c.
Referenced by InitVM_process().
#define proc_getpgid rb_f_notimplement |
Definition at line 4493 of file process.c.
Referenced by InitVM_process().
#define proc_getpgrp rb_f_notimplement |
Definition at line 4440 of file process.c.
Referenced by InitVM_process(), and rb_f_sleep().
#define proc_getpriority rb_f_notimplement |
Definition at line 4643 of file process.c.
Referenced by InitVM_process().
#define proc_getrlimit rb_f_notimplement |
Definition at line 4931 of file process.c.
Referenced by InitVM_process().
#define proc_getsid rb_f_notimplement |
Definition at line 4549 of file process.c.
Referenced by InitVM_process().
#define proc_initgroups rb_f_notimplement |
Definition at line 5953 of file process.c.
Referenced by InitVM_process().
#define proc_setegid_m rb_f_notimplement |
Definition at line 6469 of file process.c.
Referenced by InitVM_process().
#define proc_seteuid_m rb_f_notimplement |
Definition at line 6339 of file process.c.
Referenced by InitVM_process(), and proc_geteuid().
#define proc_setgid rb_f_notimplement |
Definition at line 5783 of file process.c.
Referenced by InitVM_process(), and proc_getgid().
#define proc_setgroups rb_f_notimplement |
Definition at line 5922 of file process.c.
Referenced by InitVM_process().
#define proc_setmaxgroups rb_f_notimplement |
Definition at line 6005 of file process.c.
Referenced by InitVM_process().
#define proc_setpgid rb_f_notimplement |
Definition at line 4518 of file process.c.
Referenced by InitVM_process().
#define proc_setpgrp rb_f_notimplement |
Definition at line 4468 of file process.c.
Referenced by InitVM_process().
#define proc_setpriority rb_f_notimplement |
Definition at line 4674 of file process.c.
Referenced by InitVM_process().
#define proc_setrlimit rb_f_notimplement |
Definition at line 5007 of file process.c.
Referenced by InitVM_process().
#define proc_setsid rb_f_notimplement |
Definition at line 4607 of file process.c.
Referenced by InitVM_process().
#define proc_setuid rb_f_notimplement |
Definition at line 5377 of file process.c.
Referenced by InitVM_process(), and proc_getuid().
Definition at line 518 of file process.c.
Referenced by pst_bitand(), pst_inspect(), pst_rshift(), pst_success_p(), pst_to_s(), pst_wcoredump(), pst_wexitstatus(), pst_wifexited(), pst_wifsignaled(), pst_wifstopped(), pst_wstopsig(), pst_wtermsig(), and rb_f_system().
#define rb_f_fork rb_f_notimplement |
Definition at line 3725 of file process.c.
Referenced by InitVM_process(), and rb_exec_async_signal_safe().
#define rb_intern | ( | str | ) | rb_intern_const(str) |
Referenced by Init_process().
#define rb_proc_times rb_f_notimplement |
Definition at line 6936 of file process.c.
Referenced by InitVM_process(), and p_gid_switch().
#define redirect_cloexec_dup | ( | oldfd | ) | rb_cloexec_dup(oldfd) |
Definition at line 399 of file process.c.
Referenced by close_unless_reserved(), and save_redirect_fd().
#define redirect_cloexec_dup2 | ( | oldfd, | |
newfd | |||
) | rb_cloexec_dup2((oldfd), (newfd)) |
Definition at line 400 of file process.c.
Referenced by close_unless_reserved().
#define redirect_close | ( | fd | ) | close_unless_reserved(fd) |
Definition at line 401 of file process.c.
Referenced by close_unless_reserved(), run_exec_close(), and run_exec_dup2().
#define redirect_dup | ( | oldfd | ) | dup(oldfd) |
Definition at line 397 of file process.c.
Referenced by close_unless_reserved(), and run_exec_dup2().
#define redirect_dup2 | ( | oldfd, | |
newfd | |||
) | dup2((oldfd), (newfd)) |
Definition at line 398 of file process.c.
Referenced by close_unless_reserved(), run_exec_dup2(), and run_exec_dup2_child().
#define RUBY_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID ID2SYM(id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID) |
Referenced by rb_clock_getres(), and rb_clock_gettime().
#define RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME ID2SYM(id_GETTIMEOFDAY_BASED_CLOCK_REALTIME) |
Referenced by InitVM_process(), rb_clock_getres(), and rb_clock_gettime().
#define RUBY_TIME_BASED_CLOCK_REALTIME ID2SYM(id_TIME_BASED_CLOCK_REALTIME) |
Referenced by rb_clock_getres(), and rb_clock_gettime().
#define TIMETICK_INT2NUM | ( | v | ) | LONG2NUM(v) |
Definition at line 6948 of file process.c.
Referenced by timetick2integer().
#define TIMETICK_INT_MAX LONG_MAX |
Definition at line 6947 of file process.c.
Referenced by timetick2integer().
#define TIMETICK_INT_MIN LONG_MIN |
Definition at line 6946 of file process.c.
Referenced by timetick2integer().
#define try_with_sh | ( | prog, | |
argv, | |||
envp | |||
) | (void)0 |
Definition at line 1238 of file process.c.
Referenced by proc_exec_cmd().
#define WEXITSTATUS | ( | w | ) | (((w) >> 8) & 0xff) |
Definition at line 116 of file process.c.
Referenced by pst_message(), pst_success_p(), and pst_wexitstatus().
#define WIFEXITED | ( | w | ) | (((w) & 0xff) == 0) |
Definition at line 107 of file process.c.
Referenced by pst_message(), pst_success_p(), pst_wexitstatus(), and pst_wifexited().
#define WIFSIGNALED | ( | w | ) | (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f)) |
Definition at line 110 of file process.c.
Referenced by pst_message(), pst_wifsignaled(), and pst_wtermsig().
#define WIFSTOPPED | ( | w | ) | (((w) & 0xff) == 0x7f) |
Definition at line 113 of file process.c.
Referenced by pst_message(), pst_wifstopped(), and pst_wstopsig().
#define WSTOPSIG WEXITSTATUS |
Definition at line 122 of file process.c.
Referenced by pst_message(), and pst_wstopsig().
#define WTERMSIG | ( | w | ) | ((w) & 0x7f) |
Definition at line 119 of file process.c.
Referenced by pst_message(), and pst_wtermsig().
typedef long timetick_int_t |
typedef unsigned int unsigned_clock_t |
|
static |
Definition at line 1201 of file process.c.
References after_exec_async_signal_safe(), and after_exec_non_async_signal_safe().
Referenced by rb_f_exec(), and rb_proc_exec().
|
static |
Definition at line 1189 of file process.c.
Referenced by after_exec().
|
static |
Definition at line 1194 of file process.c.
References rb_thread_reset_timer_thread(), and rb_thread_start_timer_thread().
Referenced by after_exec().
|
static |
Definition at line 1181 of file process.c.
References before_exec_async_signal_safe(), and before_exec_non_async_signal_safe().
Referenced by rb_f_exec(), and rb_proc_exec().
|
static |
Definition at line 1161 of file process.c.
Referenced by before_exec().
|
static |
Definition at line 1166 of file process.c.
References rb_thread_stop_timer_thread().
Referenced by before_exec().
Definition at line 1946 of file process.c.
References env, ENVMATCH, EXPORT_STR, hide_obj(), key, NIL_P, PATH_ENV, rb_ary_push(), rb_assoc_new(), rb_eArgError, rb_raise(), ST_CONTINUE, strchr(), StringValueCStr, and val.
Referenced by rb_check_exec_env().
|
static |
Definition at line 1873 of file process.c.
References check_exec_fds_1(), rb_execarg::close_others_maxhint, rb_execarg::fd_close, rb_execarg::fd_dup2, rb_execarg::fd_dup2_child, FIX2INT, FIXNUM_P, INT2FIX, Qtrue, RARRAY_AREF, RARRAY_LEN, rb_ary_store(), rb_eArgError, rb_hash_aset(), rb_hash_lookup(), rb_hash_new(), rb_raise(), and val.
Referenced by rb_execarg_parent_start1().
|
static |
Definition at line 1843 of file process.c.
References rb_execarg::fd_dup2, rb_execarg::fd_dup2_child, FIX2INT, INT2FIX, Qfalse, Qtrue, RARRAY_AREF, RARRAY_LEN, rb_eArgError, rb_hash_aset(), rb_hash_lookup(), rb_raise(), and RTEST.
Referenced by check_exec_fds().
Definition at line 1813 of file process.c.
References key, PRIsVALUE, rb_eArgError, rb_execarg_addopt(), rb_raise(), ST_CONTINUE, SYMBOL_P, and val.
Referenced by rb_check_exec_options().
|
static |
Definition at line 1828 of file process.c.
References key, NIL_P, rb_execarg_addopt(), rb_hash_aset(), rb_hash_new(), ST_CONTINUE, and val.
Referenced by rb_execarg_extract_options().
|
static |
Definition at line 1534 of file process.c.
References check_exec_redirect1(), check_exec_redirect_fd(), EXPORT_DUP, rb_execarg::fd_close, rb_execarg::fd_dup2, rb_execarg::fd_dup2_child, rb_execarg::fd_open, FilePathValue, FIX2INT, FIXNUM_P, waitpid_arg::flags, hide_obj(), id, ID2SYM, id_child, id_close, id_err, id_in, id_out, INT2FIX, INT2NUM, key, NIL_P, PRIsVALUE, Qfalse, Qnil, RARRAY_LEN, RARRAY_PTR, rb_ary_entry(), rb_ary_new(), rb_ary_new3, rb_ary_push(), rb_check_array_type(), rb_check_id(), rb_eArgError, rb_io_check_io(), rb_io_modestr_oflags(), rb_raise(), rb_to_int(), RB_TYPE_P, rb_execarg::rlimit_limits, StringValueCStr, SYMBOL_P, T_ARRAY, T_FILE, T_FIXNUM, T_STRING, T_SYMBOL, TYPE, and val.
Referenced by rb_execarg_addopt().
Definition at line 1512 of file process.c.
References check_exec_redirect_fd(), hide_obj(), NIL_P, Qfalse, RARRAY_AREF, RARRAY_LEN, rb_ary_new(), rb_ary_push(), rb_assoc_new(), RB_TYPE_P, and T_ARRAY.
Referenced by check_exec_redirect().
Definition at line 1471 of file process.c.
References rb_io_t::fd, FIX2INT, FIXNUM_P, GetOpenFile, id_err, id_in, id_out, INT2FIX, NIL_P, rb_check_convert_type(), rb_check_id(), rb_eArgError, rb_raise(), SYMBOL_P, T_FILE, and rb_io_t::tied_io_for_writing.
Referenced by check_exec_redirect(), and check_exec_redirect1().
|
static |
Definition at line 5021 of file process.c.
References check_uid_switch(), endpwent, errno, FIXNUM_P, GIDT2NUM, NIL_P, NULL, NUM2GIDT, NUM2UIDT, OBJ2GID, OBJ2UID, p_gid_from_name, p_sys_setuid, p_uid_from_name, Qnil, rb_check_string_type(), rb_eArgError, rb_eRuntimeError, rb_raise(), rb_str_capacity(), rb_str_modify_expand(), rb_str_resize(), rb_str_set_len(), rb_str_tmp_new(), rb_sys_fail(), rb_syserr_fail(), RSTRING_PTR, setuid(), StringValueCStr, and UIDT2NUM.
Referenced by p_gid_change_privilege(), p_gid_exchange(), p_gid_have_saved_id(), p_gid_switch(), p_uid_change_privilege(), proc_getegid(), proc_getgid(), rb_execarg_addopt(), and rb_setegid_core().
Definition at line 2017 of file process.c.
References Qnil, RB_BUILTIN_TYPE, rb_check_hash_type(), RB_SPECIAL_CONST_P, T_ARRAY, and T_STRING.
Referenced by rb_exec_getargs().
|
static |
Definition at line 5012 of file process.c.
References rb_eRuntimeError, and rb_raise().
Referenced by check_gid_switch(), p_uid_change_privilege(), p_uid_exchange(), p_uid_have_saved_id(), p_uid_switch(), proc_geteuid(), proc_getuid(), rb_execarg_addopt(), and rb_seteuid_core().
|
inlinestatic |
Definition at line 297 of file process.c.
References dup2(), errno, vm_ifunc::flags, mode_t, parent_redirect_close, parent_redirect_open, rb_async_bug_errno(), rb_cloexec_dup(), rb_cloexec_dup2(), rb_cloexec_open(), rb_reserved_fd_p(), redirect_cloexec_dup, redirect_cloexec_dup2, redirect_close, redirect_dup, and redirect_dup2.
Definition at line 2067 of file process.c.
References key, string_part::len, and string_part::ptr.
Referenced by rb_exec_fillarg().
CONSTFUNC | ( | static timetick_int_t | gcd_timetick_inttimetick_int_t, timetick_int_t | ) |
Definition at line 1079 of file process.c.
References id_pid, and rb_thread_local_aref().
Referenced by InitVM_process().
|
static |
Definition at line 1085 of file process.c.
References waitpid_arg::pid, rb_last_status_get(), and rb_waitpid().
Referenced by rb_detach_process().
Definition at line 3970 of file process.c.
References spawn_args::buflen, DATA_PTR, spawn_args::errmsg, spawn_args::execarg, spawn_args::ptr, rb_execarg_parent_start1(), and rb_spawn_process().
Referenced by rb_execarg_spawn().
|
static |
Definition at line 869 of file process.c.
References NULL, and waitpid().
Referenced by rb_waitpid(), and rb_waitpid_blocking().
|
static |
Definition at line 889 of file process.c.
References waitpid_arg::flags, waitpid_arg::pid, rb_thread_call_without_gvl(), rb_waitpid_blocking(), result, RUBY_UBF_PROCESS, and waitpid_arg::st.
Referenced by rb_waitpid().
Definition at line 2468 of file process.c.
References err, errno, rb_execarg::fd_open, FIX2INT, NIL_P, parent_redirect_close, Qfalse, Qnil, RARRAY_AREF, RARRAY_ASET, RARRAY_LEN, and rb_execarg_get().
Referenced by rb_execarg_parent_end(), and rb_execarg_spawn().
|
static |
Definition at line 3729 of file process.c.
References EXIT_FAILURE, EXIT_SUCCESS, NUM2INT, Qfalse, and Qtrue.
Referenced by rb_f_exit(), and rb_f_exit_bang().
|
static |
Definition at line 2730 of file process.c.
References ERRMSG, F_GETFD, F_SETFD, fcntl(), and FD_CLOEXEC.
Referenced by run_exec_dup2().
|
static |
Definition at line 2691 of file process.c.
References ERRMSG, F_GETFD, fcntl(), and FD_CLOEXEC.
Referenced by save_redirect_fd().
|
static |
Definition at line 2707 of file process.c.
References ERRMSG, F_GETFD, F_SETFD, fcntl(), and FD_CLOEXEC.
Referenced by run_exec_dup2().
Definition at line 2301 of file process.c.
References rb_execarg::envp_buf, key, rb_str_buf_cat(), rb_str_buf_cat2(), run_exec_dup2_tmpbuf_size(), ST_CONTINUE, StringValueCStr, and val.
Referenced by rb_execarg_parent_start1().
|
static |
Definition at line 6953 of file process.c.
Referenced by reduce_fraction().
|
static |
|
static |
Definition at line 1464 of file process.c.
References RBASIC_CLEAR_CLASS.
Referenced by check_exec_env_i(), check_exec_redirect(), check_exec_redirect1(), rb_check_exec_env(), rb_exec_fillarg(), rb_execarg_addopt(), rb_execarg_new(), rb_execarg_parent_start1(), rb_execarg_run_options(), run_exec_dup2_child(), save_env(), save_env_i(), and save_redirect_fd().
void Init_process | ( | void | ) |
Definition at line 7970 of file process.c.
References id_chdir, id_child, id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID, id_close, id_close_others, id_ENV, id_err, id_float_microsecond, id_float_millisecond, id_float_second, id_GETTIMEOFDAY_BASED_CLOCK_REALTIME, id_gid, id_hertz, id_in, id_microsecond, id_millisecond, id_nanosecond, id_out, id_pid, id_second, id_TIME_BASED_CLOCK_REALTIME, id_uid, id_umask, id_unsetenv_others, InitVM, and rb_intern.
void InitVM_process | ( | void | ) |
Definition at line 7578 of file process.c.
References CLASS_OF, CLOCK_MONOTONIC, CLOCK_REALTIME, detach_process_pid(), get_pid(), get_ppid(), getegid(), geteuid(), inf(), INT2FIX, NULL, p_gid_change_privilege(), p_gid_exchange(), p_gid_exchangeable(), p_gid_from_name, p_gid_grant_privilege(), p_gid_have_saved_id(), p_gid_switch(), p_sys_issetugid, p_sys_setegid, p_sys_seteuid, p_sys_setgid, p_sys_setregid, p_sys_setresgid, p_sys_setresuid, p_sys_setreuid, p_sys_setrgid, p_sys_setruid, p_sys_setuid, p_uid_change_privilege(), p_uid_exchange(), p_uid_exchangeable(), p_uid_from_name, p_uid_grant_privilege(), p_uid_have_saved_id(), p_uid_switch(), proc_daemon, proc_detach(), proc_getegid(), proc_geteuid(), proc_getgid(), proc_getgroups, proc_getmaxgroups, proc_getpgid, proc_getpgrp, proc_getpriority, proc_getrlimit, proc_getsid, proc_getuid(), proc_initgroups, proc_setegid_m, proc_seteuid_m, proc_setgid, proc_setgroups, proc_setmaxgroups, proc_setpgid, proc_setpgrp, proc_setpriority, proc_setrlimit, proc_setsid, proc_setuid, proc_wait(), proc_wait2(), proc_waitall(), pst_bitand(), pst_equal(), pst_inspect(), pst_pid(), pst_rshift(), pst_success_p(), pst_to_i(), pst_to_s(), pst_wcoredump(), pst_wexitstatus(), pst_wifexited(), pst_wifsignaled(), pst_wifstopped(), pst_wstopsig(), pst_wtermsig(), rb_clock_getres(), rb_clock_gettime(), rb_cObject, rb_cProcessStatus, rb_cStruct, rb_cThread, rb_cWaiter, rb_define_alias(), rb_define_class_under(), rb_define_const(), rb_define_global_function(), rb_define_method(), rb_define_module(), rb_define_module_function(), rb_define_module_under(), rb_define_singleton_method(), rb_define_virtual_variable(), rb_f_abort(), rb_f_exec(), rb_f_exit(), rb_f_exit_bang(), rb_f_fork, rb_f_kill(), rb_f_sleep(), rb_f_spawn(), rb_f_system(), rb_last_status_get(), rb_proc_times, rb_singleton_class(), rb_struct_define_under(), rb_undef_alloc_func(), rb_undef_method(), RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME, and WNOHANG.
Definition at line 2664 of file process.c.
Referenced by run_exec_dup2().
Definition at line 2670 of file process.c.
Referenced by run_exec_dup2().
|
static |
Definition at line 7092 of file process.c.
References ID2SYM, id_float_microsecond, id_float_millisecond, id_float_second, id_microsecond, id_millisecond, id_nanosecond, id_second, NIL_P, PRIsVALUE, rb_eArgError, rb_raise(), timetick2dblnum(), and timetick2integer().
Referenced by rb_clock_getres(), and rb_clock_gettime().
|
static |
Definition at line 1332 of file process.c.
References rb_execarg::chdir_dir, rb_execarg::cmd, rb_execarg::dup2_tmpbuf, rb_execarg::env_modification, rb_execarg::envp_buf, rb_execarg::envp_str, rb_execarg::fd_close, rb_execarg::fd_dup2, rb_execarg::fd_dup2_child, rb_execarg::fd_open, rb_execarg::invoke, rb_execarg::path_env, rb_gc_mark(), rb_execarg::redirect_fds, rb_execarg::rlimit_limits, rb_execarg::sh, and rb_execarg::use_shell.
|
static |
|
static |
Definition at line 2327 of file process.c.
References open_struct::err, errno, open_struct::fname, NULL, open_struct::oflags, parent_redirect_open, open_struct::perm, open_struct::ret, and RSTRING_PTR.
Referenced by rb_execarg_parent_start1().
Definition at line 6126 of file process.c.
References check_gid_switch(), EPERM, getegid(), geteuid(), getgid(), id, OBJ2GID, rb_notimplement(), rb_sys_fail(), rb_syserr_fail(), setegid(), and setgid().
Referenced by InitVM_process().
Definition at line 6631 of file process.c.
References check_gid_switch(), getegid(), getgid(), GIDT2NUM, rb_notimplement(), and rb_sys_fail().
Referenced by InitVM_process(), p_gid_sw_ensure(), and p_gid_switch().
|
static |
Definition at line 6606 of file process.c.
Referenced by InitVM_process().
Definition at line 6527 of file process.c.
References id, OBJ2GID, and rb_setegid_core().
Referenced by InitVM_process().
|
static |
Definition at line 6783 of file process.c.
References check_gid_switch(), EPERM, getegid(), getgid(), GIDT2NUM, p_gid_sw_ensure(), p_gid_switch(), Qfalse, Qnil, Qtrue, rb_block_given_p(), rb_ensure(), rb_setegid_core(), rb_syserr_fail(), rb_yield(), and UNREACHABLE.
Referenced by InitVM_process().
Definition at line 6853 of file process.c.
References p_gid_exchange().
Referenced by p_gid_have_saved_id(), and p_gid_switch().
Definition at line 6860 of file process.c.
References check_gid_switch(), DBL2NUM, EPERM, getegid(), getgid(), GIDT2NUM, p_gid_exchange(), p_gid_sw_ensure(), Qnil, rb_block_given_p(), rb_ensure(), RB_GC_GUARD, rb_proc_times, rb_struct_new(), rb_syserr_fail(), rb_yield(), tms::tms_cstime, tms::tms_cutime, tms::tms_stime, tms::tms_utime, and utime().
Referenced by InitVM_process(), and p_gid_have_saved_id().
Definition at line 5422 of file process.c.
References check_gid_switch(), check_uid_switch(), EPERM, geteuid(), getuid(), id, OBJ2GID, OBJ2UID, p_sys_setgid, Qnil, rb_notimplement(), rb_sys_fail(), rb_syserr_fail(), seteuid(), setgid(), and setuid().
Referenced by InitVM_process().
Definition at line 6569 of file process.c.
References check_uid_switch(), geteuid(), getuid(), rb_notimplement(), rb_sys_fail(), and UIDT2NUM.
Referenced by InitVM_process(), p_uid_sw_ensure(), and p_uid_switch().
|
static |
Definition at line 6544 of file process.c.
Referenced by InitVM_process().
Definition at line 6397 of file process.c.
References id, OBJ2UID, and rb_seteuid_core().
Referenced by InitVM_process().
|
static |
Definition at line 6669 of file process.c.
References check_uid_switch(), EPERM, geteuid(), getuid(), p_uid_sw_ensure(), p_uid_switch(), Qfalse, Qnil, Qtrue, rb_block_given_p(), rb_ensure(), rb_seteuid_core(), rb_syserr_fail(), rb_yield(), UIDT2NUM, and UNREACHABLE.
Referenced by InitVM_process().
Definition at line 6740 of file process.c.
References p_uid_exchange().
Referenced by p_uid_have_saved_id(), and p_uid_switch().
Definition at line 6747 of file process.c.
References check_uid_switch(), EPERM, geteuid(), getuid(), p_uid_exchange(), p_uid_sw_ensure(), Qnil, rb_block_given_p(), rb_ensure(), rb_syserr_fail(), rb_yield(), and UIDT2NUM.
Referenced by InitVM_process(), and p_uid_have_saved_id().
Definition at line 1154 of file process.c.
References NUM2PIDT, and rb_detach_process().
Referenced by InitVM_process().
Definition at line 1243 of file process.c.
References argv, ARGVSTR2ARGV, errno, NULL, preserving_errno, rb_notimplement(), rb_w32_uaspawn(), RSTRING_PTR, try_with_sh, and UNREACHABLE.
Referenced by rb_exec_async_signal_safe().
Definition at line 1277 of file process.c.
References dln_find_exe_r, errno, MAXPATHLEN, NULL, rb_notimplement(), rb_w32_uspawn(), RSTRING_PTR, and UNREACHABLE.
Referenced by rb_exec_async_signal_safe(), and rb_proc_exec().
Definition at line 6417 of file process.c.
References check_gid_switch(), getegid(), getgid(), GIDT2NUM, OBJ2GID, rb_notimplement(), rb_sys_fail(), setegid(), and setgid().
Referenced by InitVM_process().
Definition at line 6293 of file process.c.
References check_uid_switch(), geteuid(), getuid(), mod, OBJ2UID, proc_seteuid_m, rb_notimplement(), rb_sys_fail(), seteuid(), setuid(), and UIDT2NUM.
Referenced by InitVM_process().
Definition at line 5741 of file process.c.
References check_gid_switch(), getegid(), getgid(), GIDT2NUM, OBJ2GID, proc_setgid, rb_notimplement(), rb_sys_fail(), and setgid().
Referenced by InitVM_process().
Definition at line 5334 of file process.c.
References check_uid_switch(), geteuid(), getuid(), id, OBJ2UID, proc_setuid, rb_notimplement(), rb_sys_fail(), setuid(), and UIDT2NUM.
Referenced by InitVM_process().
Definition at line 982 of file process.c.
References waitpid_arg::flags, NIL_P, NUM2PIDT, NUM2UINT, waitpid_arg::pid, PIDT2NUM, Qnil, rb_check_arity, rb_last_status_clear(), rb_sys_fail(), and rb_waitpid().
Referenced by InitVM_process(), and proc_wait2().
Definition at line 1025 of file process.c.
References NIL_P, waitpid_arg::pid, proc_wait(), Qnil, rb_assoc_new(), and rb_last_status_get().
Referenced by InitVM_process().
|
static |
Definition at line 1054 of file process.c.
References errno, waitpid_arg::pid, PIDT2NUM, rb_ary_new(), rb_ary_push(), rb_assoc_new(), rb_last_status_clear(), rb_last_status_get(), rb_syserr_fail(), rb_waitpid(), and result.
Referenced by InitVM_process().
Definition at line 640 of file process.c.
References pst_to_i(), Qtrue, and rb_equal().
Referenced by InitVM_process().
Definition at line 611 of file process.c.
References CLASS_OF, NIL_P, NUM2PIDT, PST2INT, pst_message(), pst_pid(), rb_class2name(), rb_sprintf(), and rb_str_cat2().
Referenced by InitVM_process().
|
static |
Definition at line 538 of file process.c.
References rb_str_cat2(), rb_str_catf(), ruby_signal_name(), WEXITSTATUS, WIFEXITED, WIFSIGNALED, WIFSTOPPED, WSTOPSIG, and WTERMSIG.
Referenced by pst_inspect(), and pst_to_s().
Definition at line 532 of file process.c.
References id_pid, and rb_attr_get().
Referenced by InitVM_process(), pst_inspect(), and pst_to_s().
Definition at line 829 of file process.c.
References EXIT_SUCCESS, PST2INT, Qfalse, Qnil, Qtrue, WEXITSTATUS, and WIFEXITED.
Referenced by InitVM_process().
Definition at line 513 of file process.c.
References id_status, and rb_ivar_get().
Referenced by InitVM_process(), and pst_equal().
Definition at line 584 of file process.c.
References NUM2PIDT, PST2INT, pst_message(), pst_pid(), and rb_str_buf_new().
Referenced by InitVM_process().
Definition at line 810 of file process.c.
References INT2NUM, PST2INT, Qnil, WEXITSTATUS, and WIFEXITED.
Referenced by InitVM_process().
Definition at line 738 of file process.c.
References PST2INT, Qfalse, Qtrue, and WIFSIGNALED.
Referenced by InitVM_process().
Definition at line 699 of file process.c.
References PST2INT, Qfalse, Qtrue, and WIFSTOPPED.
Referenced by InitVM_process().
Definition at line 719 of file process.c.
References INT2NUM, PST2INT, Qnil, WIFSTOPPED, and WSTOPSIG.
Referenced by InitVM_process().
Definition at line 759 of file process.c.
References INT2NUM, PST2INT, Qnil, WIFSIGNALED, and WTERMSIG.
Referenced by InitVM_process().
Definition at line 1986 of file process.c.
References argc, name, NIL_P, RARRAY_AREF, RARRAY_LEN, rb_check_arity, rb_check_array_type(), rb_eArgError, rb_raise(), rb_str_new_frozen(), RSTRING_PTR, SafeStringValue, security(), StringValueCStr, and UNLIMITED_ARGUMENTS.
Referenced by rb_exec_getargs().
Definition at line 1973 of file process.c.
References check_exec_env_i(), env, hide_obj(), Qfalse, rb_ary_new(), rb_hash_tbl_raw(), st_data_t, and st_foreach.
Referenced by rb_exec_fillarg(), and rb_execarg_setenv().
Definition at line 1920 of file process.c.
References check_exec_options_i(), rb_hash_tbl_raw(), RHASH_EMPTY_P, st_data_t, and st_foreach.
Referenced by rb_exec_fillarg().
Definition at line 7463 of file process.c.
References clock_getres(), timetick::count, timetick::giga_count, ID2SYM, id_hertz, make_clock_result(), Qnil, rb_check_arity, rb_sys_fail(), rb_syserr_fail(), RUBY_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID, RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME, RUBY_TIME_BASED_CLOCK_REALTIME, SYMBOL_P, timetick2dblnum_reciprocal(), timespec::tv_nsec, and timespec::tv_sec.
Referenced by InitVM_process().
Definition at line 7268 of file process.c.
References buf, clock_gettime(), timetick::count, errno, getrusage(), gettimeofday(), timetick::giga_count, make_clock_result(), NULL, Qnil, rb_check_arity, rb_sys_fail(), rb_syserr_fail(), RUBY_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID, RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME, RUBY_TIME_BASED_CLOCK_REALTIME, SYMBOL_P, tms::tms_stime, tms::tms_utime, timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, timeval::tv_usec, usage(), and utime().
Referenced by InitVM_process().
VALUE rb_detach_process | ( | rb_pid_t | pid | ) |
Definition at line 1097 of file process.c.
References detach_process_watcher(), id_pid, PIDT2NUM, rb_cWaiter, rb_thread_create(), rb_thread_local_aset(), and RBASIC_SET_CLASS.
Referenced by proc_detach(), and pty_detach_process().
int rb_exec_async_signal_safe | ( | const struct rb_execarg * | eargp, |
char * | errmsg, | ||
size_t | errmsg_buflen | ||
) |
Definition at line 3150 of file process.c.
References after_fork_ruby, before_fork_ruby, buf, chfunc(), rb_execarg::cmd, rb_execarg::envp_str, err, ERRMSG, errno, EWOULDBLOCK, EXIT_FAILURE, EXIT_SUCCESS, getegid(), geteuid(), getgid(), getuid(), INT2FIX, rb_execarg::invoke, len, NIL_P, NSIG, NULL, waitpid_arg::pid, PIDT2NUM, preserving_errno, proc_exec_cmd(), proc_exec_sh(), Qnil, Qundef, rb_block_given_p(), rb_cloexec_fcntl_dupfd(), rb_during_gc(), rb_execarg_run_options(), rb_f_fork, rb_fork_async_signal_safe(), rb_fork_ruby(), rb_gc(), rb_hash_lookup(), rb_jump_tag(), rb_pipe(), rb_protect(), rb_sys_fail(), rb_syserr_fail(), rb_syswait(), rb_thread_atfork(), rb_thread_sleep(), rb_update_max_fd(), rb_yield(), RSTRING_PTR, RTEST, ruby_stop(), rb_execarg::sh, size, strlen(), and rb_execarg::use_shell.
Referenced by chfunc(), rb_f_exec(), and rb_pipe().
|
static |
Definition at line 2503 of file process.c.
References rb_execarg::chdir_dir, err, rb_execarg_get(), RB_GC_GUARD, rb_sys_fail(), and rb_sys_fail_str().
Referenced by rb_f_exec(), and rb_f_spawn().
|
static |
Definition at line 2077 of file process.c.
References argc, rb_execarg::cmd, compare_posix_sh(), dln_find_exe_r, env, rb_execarg::env_modification, EXPORT_STR, hide_obj(), rb_execarg::invoke, string_part::len, MAXPATHLEN, MEMZERO, NIL_P, NULL, numberof, rb_execarg::path_env, string_part::ptr, Qnil, rb_check_exec_env(), rb_check_exec_options(), rb_execarg_get(), RB_GC_GUARD, rb_str_buf_cat(), rb_str_buf_new(), rb_str_new_cstr(), RSTRING_LEN, RSTRING_PTR, RTEST, rb_execarg::sh, strchr(), StringValueCStr, strlen(), and rb_execarg::use_shell.
Referenced by rb_execarg_init().
|
static |
Definition at line 2029 of file process.c.
References check_hash(), hash(), NIL_P, and rb_check_argv().
Referenced by rb_execarg_init().
Definition at line 1669 of file process.c.
References rb_execarg::chdir_dir, rb_execarg::chdir_given, check_exec_redirect(), check_gid_switch(), check_uid_switch(), rb_execarg::close_others_do, rb_execarg::close_others_given, EXPORT_DUP, FilePathValue, rb_execarg::gid, rb_execarg::gid_given, hide_obj(), id, id_chdir, id_close_others, id_err, id_gid, id_in, id_out, id_uid, id_umask, id_unsetenv_others, INT2FIX, mode_t, rb_execarg::new_pgroup_flag, rb_execarg::new_pgroup_given, NUM2MODET, NUM2PIDT, OBJ2GID, OBJ2UID, rb_execarg::pgroup_given, rb_execarg::pgroup_pgid, Qtrue, rb_check_id(), rb_eArgError, rb_eNotImpError, rb_execarg_get(), RB_GC_GUARD, rb_raise(), rb_str_encode_ospath(), RTEST, ST_CONTINUE, ST_STOP, T_ARRAY, T_FILE, T_FIXNUM, T_SYMBOL, TYPE, rb_execarg::uid, rb_execarg::uid_given, rb_execarg::umask_given, rb_execarg::umask_mask, rb_execarg::unsetenv_others_do, and rb_execarg::unsetenv_others_given.
Referenced by check_exec_options_i(), check_exec_options_i_extract(), pipe_open(), and rb_execarg_parent_start1().
char* rb_execarg_commandline | ( | const struct rb_execarg * | eargp, |
VALUE * | prog | ||
) |
Definition at line 3894 of file process.c.
References argc, argv, ARGVSTR2ARGC, ARGVSTR2ARGV, rb_execarg::cmd, rb_execarg::invoke, rb_str_new(), RSTRING_LEN, RSTRING_PTR, StringValueCStr, and rb_execarg::use_shell.
Referenced by pipe_open(), rb_pipe(), and rb_spawn_process().
Definition at line 1928 of file process.c.
References check_exec_options_i_extract(), Qnil, rb_hash_tbl_raw(), RHASH_EMPTY_P, st_data_t, and st_foreach.
Referenced by rb_io_s_popen().
struct rb_execarg* rb_execarg_get | ( | VALUE | execarg_obj | ) |
Definition at line 2268 of file process.c.
References TypedData_Get_Struct.
Referenced by establishShell(), execarg_parent_end(), pipe_open(), rb_exec_fail(), rb_exec_fillarg(), rb_execarg_addopt(), rb_execarg_init(), rb_execarg_parent_start1(), rb_execarg_setenv(), rb_f_exec(), and rb_f_spawn().
Definition at line 2276 of file process.c.
References ALLOCV_END, ALLOCV_N, argv, rb_execarg::argv_buf, rb_execarg::cmd, env, rb_execarg::invoke, MEMCPY, Qnil, rb_exec_fillarg(), rb_exec_getargs(), rb_execarg_get(), RB_GC_GUARD, rb_execarg::sh, and rb_execarg::use_shell.
Referenced by rb_execarg_new().
Definition at line 2257 of file process.c.
References hide_obj(), rb_cData, rb_execarg_init(), and TypedData_Make_Struct.
Referenced by establishShell(), pipe_open_s(), rb_f_exec(), rb_f_spawn(), rb_io_s_popen(), and rb_spawn_internal().
void rb_execarg_parent_end | ( | VALUE | execarg_obj | ) |
Definition at line 2496 of file process.c.
References execarg_parent_end(), and RB_GC_GUARD.
Referenced by establishShell(), pipe_open(), and rb_execarg_parent_start().
void rb_execarg_parent_start | ( | VALUE | execarg_obj | ) |
Definition at line 2457 of file process.c.
References rb_execarg_parent_end(), rb_execarg_parent_start1(), rb_jump_tag(), and rb_protect().
Referenced by establishShell(), pipe_open(), rb_f_exec(), and rb_pipe().
Definition at line 2337 of file process.c.
References ALWAYS_NEED_ENVP, check_exec_fds(), rb_execarg::dup2_tmpbuf, rb_execarg::env_modification, rb_execarg::envp_buf, rb_execarg::envp_str, envtbl, open_struct::err, rb_execarg::fd_dup2, rb_execarg::fd_open, FilePathValue, fill_envp_buf_i(), FIX2INT, waitpid_arg::flags, open_struct::fname, hide_obj(), id_ENV, INT2FIX, key, len, NIL_P, NULL, NUM2INT, open_struct::oflags, open_func(), open_struct::perm, Qfalse, Qnil, Qundef, RARRAY_AREF, RARRAY_ASET, RARRAY_LEN, rb_cObject, rb_const_get(), rb_convert_type(), rb_execarg_addopt(), rb_execarg_get(), RB_GC_GUARD, rb_hash_new(), RB_OBJ_WRITTEN, rb_str_buf_cat(), rb_str_buf_new(), rb_str_encode_ospath(), rb_str_new(), rb_str_set_len(), rb_syserr_fail_str(), rb_thread_call_without_gvl2(), rb_thread_check_ints(), rb_update_max_fd(), rb_execarg::redirect_fds, open_struct::ret, RHASH_SIZE, RHASH_TBL_RAW, RSTRING_LEN, RSTRING_PTR, RUBY_UBF_IO, run_exec_dup2_tmpbuf_size(), st_data_t, st_delete, st_foreach, st_insert, strlen(), T_HASH, tmpbuf, rb_execarg::unsetenv_others_do, rb_execarg::unsetenv_others_given, and val.
Referenced by do_spawn_process(), and rb_execarg_parent_start().
int rb_execarg_run_options | ( | const struct rb_execarg * | eargp, |
struct rb_execarg * | sargp, | ||
char * | errmsg, | ||
size_t | errmsg_buflen | ||
) |
Definition at line 3021 of file process.c.
References rb_execarg::chdir_dir, rb_execarg::chdir_given, rb_execarg::close_others_do, rb_execarg::close_others_given, rb_execarg::close_others_maxhint, rb_execarg::dup2_tmpbuf, rb_execarg::env_modification, ERRMSG, rb_execarg::fd_close, rb_execarg::fd_dup2, rb_execarg::fd_dup2_child, rb_execarg::gid, rb_execarg::gid_given, hide_obj(), key, len, MEMZERO, mode_t, my_getcwd, NIL_P, rb_execarg::pgroup_given, Qfalse, Qnil, RARRAY_AREF, RARRAY_LEN, rb_close_before_exec(), rb_env_clear(), rb_str_new(), rb_str_new2, rb_str_set_len(), rb_warn(), rb_execarg::redirect_fds, rb_execarg::rlimit_limits, RSTRING_PTR, ruby_setenv(), run_exec_close(), run_exec_dup2(), run_exec_dup2_child(), run_exec_dup2_tmpbuf_size(), save_env(), setgid(), setuid(), StringValueCStr, tmpbuf, rb_execarg::uid, rb_execarg::uid_given, umask(), rb_execarg::umask_given, rb_execarg::umask_mask, rb_execarg::unsetenv_others_do, rb_execarg::unsetenv_others_given, val, and xfree().
Referenced by pipe_open(), rb_exec_async_signal_safe(), and rb_spawn_process().
Definition at line 2293 of file process.c.
References env, rb_execarg::env_modification, NIL_P, rb_execarg::path_env, Qfalse, rb_check_exec_env(), and rb_execarg_get().
Referenced by rb_io_s_popen().
|
static |
Definition at line 3979 of file process.c.
References spawn_args::buflen, do_spawn_process(), spawn_args::errmsg, spawn_args::execarg, execarg_parent_end(), spawn_args::ptr, and rb_ensure().
Referenced by rb_f_spawn(), and rb_spawn_internal().
void rb_exit | ( | int | status | ) |
Definition at line 3779 of file process.c.
References GET_THREAD, INT2NUM, rb_class_new_instance(), rb_eSystemExit, rb_exc_raise(), rb_str_new2, and ruby_stop().
Referenced by rb_f_abort(), rb_f_exit(), and rb_thread_kill().
Definition at line 3862 of file process.c.
References EXIT_FAILURE, GET_THREAD, INT2NUM, NIL_P, rb_check_arity, rb_class_new_instance(), rb_eSystemExit, rb_exc_raise(), rb_exit(), rb_io_puts(), rb_stderr, ruby_error_print(), StringValue, and UNREACHABLE.
Referenced by InitVM_process().
Definition at line 2596 of file process.c.
References after_exec(), before_exec(), CHILD_ERRMSG_BUFLEN, rb_execarg::cmd, err, errno, rb_execarg::invoke, rb_exec_async_signal_safe(), rb_exec_fail(), rb_execarg_get(), rb_execarg_new(), rb_execarg_parent_start(), RB_GC_GUARD, rb_syserr_fail_str(), rb_execarg::sh, TRUE, UNREACHABLE, and rb_execarg::use_shell.
Referenced by InitVM_process().
Definition at line 3834 of file process.c.
References exit_status_code(), EXIT_SUCCESS, rb_check_arity, rb_exit(), and UNREACHABLE.
Referenced by InitVM_process().
Definition at line 3763 of file process.c.
References EXIT_FAILURE, exit_status_code(), rb_check_arity, and UNREACHABLE.
Referenced by InitVM_process().
Definition at line 4393 of file process.c.
References INT2FIX, PIDT2NUM, proc_getpgrp, rb_check_arity, rb_sys_fail(), rb_thread_sleep_forever(), rb_thread_wait_for(), and rb_time_interval().
Referenced by InitVM_process().
Definition at line 4349 of file process.c.
References CHILD_ERRMSG_BUFLEN, rb_execarg::cmd, err, errno, rb_execarg::invoke, waitpid_arg::pid, PIDT2NUM, Qnil, rb_exec_fail(), rb_execarg_get(), rb_execarg_new(), rb_execarg_spawn(), RB_GC_GUARD, rb_syserr_fail_str(), rb_execarg::sh, TRUE, and rb_execarg::use_shell.
Referenced by InitVM_process().
Definition at line 4045 of file process.c.
References chfunc(), EXIT_SUCCESS, NULL, waitpid_arg::pid, PST2INT, Qfalse, Qnil, Qtrue, rb_last_status_clear(), rb_last_status_get(), rb_spawn_internal(), rb_sys_fail(), and rb_waitpid().
Referenced by InitVM_process().
void rb_last_status_clear | ( | void | ) |
Definition at line 494 of file process.c.
References GET_THREAD, and Qnil.
Referenced by fptr_waitpid(), proc_wait(), proc_waitall(), rb_f_backquote(), and rb_f_system().
VALUE rb_last_status_get | ( | void | ) |
Definition at line 479 of file process.c.
References GET_THREAD.
Referenced by detach_process_watcher(), InitVM_process(), proc_wait2(), proc_waitall(), pty_check(), raise_from_check(), and rb_f_system().
void rb_last_status_set | ( | int | status, |
rb_pid_t | pid | ||
) |
Definition at line 485 of file process.c.
References GET_THREAD, id_pid, id_status, INT2FIX, rb_thread_struct::last_status, PIDT2NUM, rb_cProcessStatus, rb_ivar_set(), and rb_obj_alloc().
Referenced by pipe_finalize(), rb_spawn_process(), and rb_waitpid().
int rb_proc_exec | ( | const char * | str | ) |
Definition at line 1322 of file process.c.
References after_exec(), before_exec(), preserving_errno, proc_exec_sh(), and Qfalse.
|
static |
Definition at line 6473 of file process.c.
References check_gid_switch(), geteuid(), getgid(), rb_notimplement(), rb_sys_fail(), setegid(), and setgid().
Referenced by p_gid_grant_privilege(), and p_gid_have_saved_id().
|
static |
Definition at line 6343 of file process.c.
References check_uid_switch(), geteuid(), getuid(), rb_notimplement(), rb_sys_fail(), seteuid(), and setuid().
Referenced by p_uid_grant_privilege(), and p_uid_have_saved_id().
Definition at line 4006 of file process.c.
References NULL, and rb_spawn_internal().
Definition at line 4000 of file process.c.
References rb_spawn_internal().
|
static |
Definition at line 3991 of file process.c.
References rb_execarg_new(), rb_execarg_spawn(), and TRUE.
Referenced by rb_f_system(), rb_spawn(), and rb_spawn_err().
|
static |
Definition at line 3916 of file process.c.
References argv, ARGVSTR2ARGV, rb_execarg::cmd, rb_execarg::invoke, NULL, waitpid_arg::pid, rb_execarg_commandline(), rb_execarg_run_options(), rb_fork_async_signal_safe(), rb_last_status_set(), rb_execarg::redirect_fds, RSTRING_PTR, rb_execarg::sh, and rb_execarg::use_shell.
Referenced by do_spawn_process().
void rb_syswait | ( | rb_pid_t | pid | ) |
Definition at line 3885 of file process.c.
References rb_waitpid().
Referenced by rb_exec_async_signal_safe().
rb_pid_t rb_waitpid | ( | rb_pid_t | pid, |
int * | st, | ||
int | flags | ||
) |
Definition at line 902 of file process.c.
References do_waitpid(), do_waitpid_nonblocking(), errno, GET_THREAD, rb_last_status_set(), result, RUBY_VM_CHECK_INTS, and WNOHANG.
Referenced by detach_process_watcher(), fptr_waitpid(), proc_wait(), proc_waitall(), pty_check(), pty_detach_process(), rb_f_system(), and rb_syswait().
|
static |
Definition at line 881 of file process.c.
References do_waitpid(), waitpid_arg::flags, waitpid_arg::pid, result, and waitpid_arg::st.
Referenced by do_waitpid_nonblocking().
|
static |
Definition at line 6983 of file process.c.
References reduce_fraction().
Referenced by timetick2dblnum(), timetick2dblnum_reciprocal(), and timetick2integer().
|
static |
Definition at line 6973 of file process.c.
References gcd_timetick_int().
Referenced by reduce_factors().
|
static |
Definition at line 2876 of file process.c.
References ERRMSG, FIX2INT, RARRAY_AREF, RARRAY_LEN, and redirect_close.
Referenced by rb_execarg_run_options().
|
static |
Definition at line 2753 of file process.c.
References run_exec_dup2_fd_pair::cloexec, ERRMSG, fail, fd_clear_cloexec(), fd_set_cloexec(), FIX2INT, intcmp(), intrcmp(), run_exec_dup2_fd_pair::newfd, run_exec_dup2_fd_pair::num_newer, run_exec_dup2_fd_pair::older_index, run_exec_dup2_fd_pair::oldfd, RARRAY_AREF, RARRAY_LEN, rb_update_max_fd(), redirect_close, redirect_dup, redirect_dup2, RSTRING_PTR, RTEST, and save_redirect_fd().
Referenced by rb_execarg_run_options().
|
static |
Definition at line 2895 of file process.c.
References ERRMSG, FIX2INT, hide_obj(), run_exec_dup2_fd_pair::newfd, NUM2INT, run_exec_dup2_fd_pair::oldfd, rb_execarg::pgroup_given, rb_execarg::pgroup_pgid, Qfalse, RARRAY_AREF, RARRAY_LEN, rb_ary_new(), rb_ary_new3, rb_ary_push(), rb_update_max_fd(), redirect_dup2, rb_execarg::rlimit_limits, and save_redirect_fd().
Referenced by rb_execarg_run_options().
|
static |
Definition at line 2684 of file process.c.
Referenced by fill_envp_buf_i(), rb_execarg_parent_start1(), and rb_execarg_run_options().
|
static |
Definition at line 2996 of file process.c.
References env, rb_execarg::env_modification, hide_obj(), id_ENV, Qfalse, rb_ary_new(), rb_block_call(), rb_cObject, rb_const_get(), RTEST, save_env_i(), rb_execarg::unsetenv_others_do, and rb_execarg::unsetenv_others_given.
Referenced by rb_execarg_run_options().
|
static |
Definition at line 2989 of file process.c.
References argv, hide_obj(), Qnil, rb_ary_dup(), and rb_ary_push().
Referenced by save_env().
|
static |
Definition at line 2630 of file process.c.
References ERRMSG, errno, rb_execarg::fd_close, rb_execarg::fd_dup2, fd_get_cloexec(), hide_obj(), INT2FIX, Qfalse, Qnil, Qtrue, rb_ary_new(), rb_ary_push(), rb_assoc_new(), rb_update_max_fd(), and redirect_cloexec_dup.
Referenced by run_exec_dup2(), and run_exec_dup2_child().
|
static |
Definition at line 1213 of file process.c.
References argv, rb_env_path_tainted(), rb_eSecurityError, rb_raise(), and rb_safe_level().
Referenced by rb_check_argv().
|
static |
Definition at line 7004 of file process.c.
References timetick::count, DBL2NUM, timetick::giga_count, and reduce_factors().
Referenced by make_clock_result().
|
static |
Definition at line 7025 of file process.c.
References timetick::count, DBL2NUM, timetick::giga_count, and reduce_factors().
Referenced by rb_clock_getres().
|
static |
Definition at line 7049 of file process.c.
References timetick::count, DIV, timetick::giga_count, LONG2FIX, MUL_OVERFLOW_SIGNED_INTEGER_P, rb_funcall(), reduce_factors(), TIMETICK_INT2NUM, TIMETICK_INT_MAX, and TIMETICK_INT_MIN.
Referenced by make_clock_result().
|
static |
|
static |
Definition at line 268 of file process.c.
Referenced by Init_process(), and rb_execarg_addopt().
|
static |
Definition at line 261 of file process.c.
Referenced by check_exec_redirect(), and Init_process().
|
static |
Definition at line 279 of file process.c.
Referenced by Init_process().
|
static |
Definition at line 261 of file process.c.
Referenced by check_exec_redirect(), and Init_process().
|
static |
Definition at line 268 of file process.c.
Referenced by Init_process(), and rb_execarg_addopt().
|
static |
Definition at line 268 of file process.c.
Referenced by Init_process(), rb_execarg_parent_start1(), and save_env().
|
static |
Definition at line 260 of file process.c.
Referenced by check_exec_redirect(), check_exec_redirect_fd(), Init_process(), and rb_execarg_addopt().
|
static |
Definition at line 270 of file process.c.
Referenced by Init_process(), and make_clock_result().
|
static |
Definition at line 270 of file process.c.
Referenced by Init_process(), and make_clock_result().
|
static |
Definition at line 270 of file process.c.
Referenced by Init_process(), and make_clock_result().
|
static |
Definition at line 271 of file process.c.
Referenced by Init_process().
|
static |
Definition at line 260 of file process.c.
Referenced by Init_process(), and rb_execarg_addopt().
|
static |
Definition at line 283 of file process.c.
Referenced by Init_process(), and rb_clock_getres().
|
static |
Definition at line 260 of file process.c.
Referenced by check_exec_redirect(), check_exec_redirect_fd(), Init_process(), and rb_execarg_addopt().
|
static |
Definition at line 269 of file process.c.
Referenced by Init_process(), and make_clock_result().
|
static |
Definition at line 269 of file process.c.
Referenced by Init_process(), and make_clock_result().
|
static |
Definition at line 269 of file process.c.
Referenced by Init_process(), and make_clock_result().
|
static |
Definition at line 260 of file process.c.
Referenced by check_exec_redirect(), check_exec_redirect_fd(), Init_process(), and rb_execarg_addopt().
|
static |
Definition at line 260 of file process.c.
Referenced by detach_process_pid(), Init_process(), pst_pid(), rb_detach_process(), and rb_last_status_set().
|
static |
Definition at line 269 of file process.c.
Referenced by Init_process(), and make_clock_result().
|
static |
Definition at line 271 of file process.c.
Referenced by Init_process().
|
static |
Definition at line 260 of file process.c.
Referenced by Init_process(), and rb_execarg_addopt().
|
static |
Definition at line 268 of file process.c.
Referenced by Init_process(), and rb_execarg_addopt().
|
static |
Definition at line 268 of file process.c.
Referenced by Init_process(), and rb_execarg_addopt().
|
static |
Definition at line 476 of file process.c.
Referenced by InitVM_process(), and rb_last_status_set().
|
static |
Definition at line 1076 of file process.c.
Referenced by InitVM_process(), and rb_detach_process().