Ruby  2.1.10p492(2016-04-01revision54464)
Data Structures | Macros | Typedefs | Functions | Variables
process.c File Reference
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "internal.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  wait_data
 
struct  string_part
 
struct  run_exec_dup2_fd_pair
 
struct  timetick
 

Macros

#define EXIT_SUCCESS   0
 
#define EXIT_FAILURE   1
 
#define MAXPATHLEN   1024
 
#define WIFEXITED(w)   (((w) & 0xff) == 0)
 
#define WIFSIGNALED(w)   (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
 
#define WIFSTOPPED(w)   (((w) & 0xff) == 0x7f)
 
#define WEXITSTATUS(w)   (((w) >> 8) & 0xff)
 
#define WTERMSIG(w)   ((w) & 0x7f)
 
#define WSTOPSIG   WEXITSTATUS
 
#define preserving_errno(stmts)   do {int saved_errno = errno; stmts; errno = saved_errno;} while (0)
 
#define p_uid_from_name   p_uid_from_name
 
#define p_gid_from_name   p_gid_from_name
 
#define PREPARE_GETPWNAM   /* do nothing */
 
#define FINISH_GETPWNAM   /* do nothing */
 
#define OBJ2UID(id)   NUM2UIDT(id)
 
#define p_uid_from_name   rb_f_notimplement
 
#define PREPARE_GETGRNAM   /* do nothing */
 
#define FINISH_GETGRNAM   /* do nothing */
 
#define OBJ2GID(id)   NUM2GIDT(id)
 
#define p_gid_from_name   rb_f_notimplement
 
#define PST2INT(st)   NUM2INT(pst_to_i(st))
 
#define NO_WAITPID
 
#define before_fork()   before_exec()
 
#define after_fork()   (rb_threadptr_pending_interrupt_clear(GET_THREAD()), after_exec())
 
#define try_with_sh(prog, argv, envp)   (void)0
 
#define ARGV_COUNT(n)   ((n)+1)
 
#define ARGV_SIZE(n)   (sizeof(char*) * ARGV_COUNT(n))
 
#define ALLOC_ARGV(n, v)   ALLOCV_N(char*, (v), ARGV_COUNT(n))
 
#define EXPORT_STR(str)   (str)
 
#define EXPORT_DUP(str)   rb_str_dup(str)
 
#define USE_SPAWNV   0
 
#define P_NOWAIT   _P_NOWAIT
 
#define CHILD_ERRMSG_BUFLEN   80
 
#define ERRMSG(str)   do { if (errmsg && 0 < errmsg_buflen) strlcpy(errmsg, (str), errmsg_buflen); } while (0)
 
#define redirect_dup(oldfd)   dup(oldfd)
 
#define redirect_dup2(oldfd, newfd)   dup2((oldfd), (newfd))
 
#define redirect_close(fd)   close(fd)
 
#define redirect_open(pathname, flags, perm)   open((pathname), (flags), (perm))
 
#define rb_f_fork   rb_f_notimplement
 
#define proc_getpgrp   rb_f_notimplement
 
#define proc_setpgrp   rb_f_notimplement
 
#define proc_getpgid   rb_f_notimplement
 
#define proc_setpgid   rb_f_notimplement
 
#define proc_getsid   rb_f_notimplement
 
#define proc_setsid   rb_f_notimplement
 
#define proc_getpriority   rb_f_notimplement
 
#define proc_setpriority   rb_f_notimplement
 
#define proc_getrlimit   rb_f_notimplement
 
#define proc_setrlimit   rb_f_notimplement
 
#define p_sys_setuid   rb_f_notimplement
 
#define p_sys_setruid   rb_f_notimplement
 
#define p_sys_seteuid   rb_f_notimplement
 
#define p_sys_setreuid   rb_f_notimplement
 
#define p_sys_setresuid   rb_f_notimplement
 
#define proc_setuid   rb_f_notimplement
 
#define p_sys_setgid   rb_f_notimplement
 
#define p_sys_setrgid   rb_f_notimplement
 
#define p_sys_setegid   rb_f_notimplement
 
#define p_sys_setregid   rb_f_notimplement
 
#define p_sys_setresgid   rb_f_notimplement
 
#define p_sys_issetugid   rb_f_notimplement
 
#define proc_setgid   rb_f_notimplement
 
#define proc_getgroups   rb_f_notimplement
 
#define proc_setgroups   rb_f_notimplement
 
#define proc_initgroups   rb_f_notimplement
 
#define proc_getmaxgroups   rb_f_notimplement
 
#define proc_setmaxgroups   rb_f_notimplement
 
#define proc_daemon   rb_f_notimplement
 
#define proc_seteuid_m   rb_f_notimplement
 
#define proc_setegid_m   rb_f_notimplement
 
#define rb_proc_times   rb_f_notimplement
 
#define TIMETICK_INT_MIN   LONG_MIN
 
#define TIMETICK_INT_MAX   LONG_MAX
 
#define TIMETICK_INT2NUM(v)   LONG2NUM(v)
 
#define NDIV(x, y)   (-(-((x)+1)/(y))-1)
 
#define DIV(n, d)   ((n)<0 ? NDIV((n),(d)) : (n)/(d))
 
#define RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME   ID2SYM(rb_intern("GETTIMEOFDAY_BASED_CLOCK_REALTIME"))
 
#define RUBY_TIME_BASED_CLOCK_REALTIME   ID2SYM(rb_intern("TIME_BASED_CLOCK_REALTIME"))
 
#define RUBY_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID   ID2SYM(rb_intern("CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID"))
 
#define rb_intern(str)   rb_intern_const(str)
 

Typedefs

typedef unsigned int unsigned_clock_t
 
typedef long timetick_int_t
 

Functions

static void check_uid_switch (void)
 
static void check_gid_switch (void)
 
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 int wait_each (rb_pid_t pid, int status, struct wait_data *data)
 
static int waitall_each (rb_pid_t pid, int status, VALUE ary)
 
static void * rb_waitpid_blocking (void *data)
 
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 ID id_pid (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_v (char **argv, const char *prog)
 
int rb_proc_exec_n (int argc, VALUE *argv, const char *prog)
 
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 void free_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)
 
int rb_exec_arg_addopt (struct rb_exec_arg *e, 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)
 
static VALUE rb_check_argv (int argc, VALUE *argv)
 
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, VALUE *argv, int accept_shell)
 
struct rb_execargrb_execarg_get (VALUE execarg_obj)
 
VALUE rb_execarg_init (int argc, VALUE *argv, int accept_shell, VALUE execarg_obj)
 
VALUE rb_exec_arg_init (int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
 
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)
 
void rb_execarg_fixup (VALUE execarg_obj)
 
void rb_exec_arg_fixup (struct rb_exec_arg *e)
 
static int rb_exec_without_timer_thread (const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
 
VALUE rb_f_exec (int argc, VALUE *argv)
 
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_open (VALUE ary, struct rb_execarg *sargp, 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_run_exec_options_err (const struct rb_exec_arg *e, struct rb_exec_arg *s, char *errmsg, size_t errmsg_buflen)
 
int rb_run_exec_options (const struct rb_exec_arg *e, struct rb_exec_arg *s)
 
int rb_exec_async_signal_safe (const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
 
int rb_exec_err (const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
 
int rb_exec (const struct rb_exec_arg *e)
 
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, VALUE *argv)
 
VALUE rb_f_abort (int argc, VALUE *argv)
 
void rb_syswait (rb_pid_t pid)
 
static rb_pid_t rb_spawn_process (struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
 
static rb_pid_t rb_spawn_internal (int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
 
rb_pid_t rb_spawn_err (int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
 
rb_pid_t rb_spawn (int argc, 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)
 
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 Init_process (void)
 

Variables

static VALUE rb_cProcessStatus
 
static st_tablepid_tbl
 
static int forked_child = 0
 
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
 

Macro Definition Documentation

◆ after_fork

#define after_fork ( )    (rb_threadptr_pending_interrupt_clear(GET_THREAD()), after_exec())

Definition at line 1166 of file process.c.

◆ ALLOC_ARGV

#define ALLOC_ARGV (   n,
 
)    ALLOCV_N(char*, (v), ARGV_COUNT(n))

Referenced by rb_proc_exec_n().

◆ ARGV_COUNT

#define ARGV_COUNT (   n)    ((n)+1)

◆ ARGV_SIZE

#define ARGV_SIZE (   n)    (sizeof(char*) * ARGV_COUNT(n))

◆ before_fork

#define before_fork ( )    before_exec()

Definition at line 1165 of file process.c.

◆ CHILD_ERRMSG_BUFLEN

#define CHILD_ERRMSG_BUFLEN   80

Referenced by rb_f_exec(), and rb_f_spawn().

◆ DIV

#define DIV (   n,
 
)    ((n)<0 ? NDIV((n),(d)) : (n)/(d))

Definition at line 6882 of file process.c.

Referenced by timetick2integer().

◆ ERRMSG

#define ERRMSG (   str)    do { if (errmsg && 0 < errmsg_buflen) strlcpy(errmsg, (str), errmsg_buflen); } while (0)

◆ EXIT_FAILURE

#define EXIT_FAILURE   1

Definition at line 44 of file process.c.

Referenced by exit_status_code(), rb_f_abort(), and rb_f_exit_bang().

◆ EXIT_SUCCESS

#define EXIT_SUCCESS   0

Definition at line 41 of file process.c.

Referenced by exit_status_code(), pst_success_p(), rb_f_exit(), and rb_f_system().

◆ EXPORT_DUP

#define EXPORT_DUP (   str)    rb_str_dup(str)

Definition at line 1426 of file process.c.

Referenced by check_exec_redirect(), and rb_execarg_addopt().

◆ EXPORT_STR

#define EXPORT_STR (   str)    (str)

Definition at line 1425 of file process.c.

Referenced by check_exec_env_i(), and rb_exec_fillarg().

◆ FINISH_GETGRNAM

#define FINISH_GETGRNAM   /* do nothing */

Definition at line 230 of file process.c.

◆ FINISH_GETPWNAM

#define FINISH_GETPWNAM   /* do nothing */

Definition at line 189 of file process.c.

◆ MAXPATHLEN

#define MAXPATHLEN   1024

Definition at line 57 of file process.c.

Referenced by proc_exec_sh(), proc_exec_v(), and rb_exec_fillarg().

◆ NDIV

#define NDIV (   x,
 
)    (-(-((x)+1)/(y))-1)

Definition at line 6881 of file process.c.

◆ NO_WAITPID

#define NO_WAITPID

Definition at line 705 of file process.c.

◆ OBJ2GID

#define OBJ2GID (   id)    NUM2GIDT(id)

Definition at line 231 of file process.c.

Referenced by p_gid_change_privilege(), p_gid_grant_privilege(), and rb_execarg_addopt().

◆ OBJ2UID

#define OBJ2UID (   id)    NUM2UIDT(id)

Definition at line 190 of file process.c.

Referenced by p_uid_change_privilege(), p_uid_grant_privilege(), and rb_execarg_addopt().

◆ p_gid_from_name [1/2]

#define p_gid_from_name   p_gid_from_name

Definition at line 234 of file process.c.

Referenced by Init_process().

◆ p_gid_from_name [2/2]

#define p_gid_from_name   rb_f_notimplement

Definition at line 234 of file process.c.

◆ P_NOWAIT

#define P_NOWAIT   _P_NOWAIT

Definition at line 1435 of file process.c.

Referenced by check_spawn_mode().

◆ p_sys_issetugid

#define p_sys_issetugid   rb_f_notimplement

Definition at line 5555 of file process.c.

Referenced by Init_process().

◆ p_sys_setegid

#define p_sys_setegid   rb_f_notimplement

Definition at line 5468 of file process.c.

Referenced by Init_process().

◆ p_sys_seteuid

#define p_sys_seteuid   rb_f_notimplement

Definition at line 5084 of file process.c.

Referenced by Init_process().

◆ p_sys_setgid

#define p_sys_setgid   rb_f_notimplement

Definition at line 5424 of file process.c.

Referenced by Init_process().

◆ p_sys_setregid

#define p_sys_setregid   rb_f_notimplement

Definition at line 5497 of file process.c.

Referenced by Init_process().

◆ p_sys_setresgid

#define p_sys_setresgid   rb_f_notimplement

Definition at line 5526 of file process.c.

Referenced by Init_process().

◆ p_sys_setresuid

#define p_sys_setresuid   rb_f_notimplement

Definition at line 5143 of file process.c.

Referenced by Init_process().

◆ p_sys_setreuid

#define p_sys_setreuid   rb_f_notimplement

Definition at line 5113 of file process.c.

Referenced by Init_process().

◆ p_sys_setrgid

#define p_sys_setrgid   rb_f_notimplement

Definition at line 5446 of file process.c.

Referenced by Init_process().

◆ p_sys_setruid

#define p_sys_setruid   rb_f_notimplement

Definition at line 5062 of file process.c.

Referenced by Init_process().

◆ p_sys_setuid

#define p_sys_setuid   rb_f_notimplement

Definition at line 5040 of file process.c.

Referenced by Init_process().

◆ p_uid_from_name [1/2]

#define p_uid_from_name   p_uid_from_name

Definition at line 193 of file process.c.

Referenced by Init_process().

◆ p_uid_from_name [2/2]

#define p_uid_from_name   rb_f_notimplement

Definition at line 193 of file process.c.

◆ PREPARE_GETGRNAM

#define PREPARE_GETGRNAM   /* do nothing */

Definition at line 229 of file process.c.

◆ PREPARE_GETPWNAM

#define PREPARE_GETPWNAM   /* do nothing */

Definition at line 188 of file process.c.

◆ preserving_errno

#define preserving_errno (   stmts)    do {int saved_errno = errno; stmts; errno = saved_errno;} while (0)

◆ proc_daemon

#define proc_daemon   rb_f_notimplement

Definition at line 5911 of file process.c.

Referenced by Init_process().

◆ proc_getgroups

#define proc_getgroups   rb_f_notimplement

Definition at line 5703 of file process.c.

Referenced by Init_process().

◆ proc_getmaxgroups

#define proc_getmaxgroups   rb_f_notimplement

Definition at line 5803 of file process.c.

Referenced by Init_process().

◆ proc_getpgid

#define proc_getpgid   rb_f_notimplement

Definition at line 4332 of file process.c.

Referenced by Init_process().

◆ proc_getpgrp

#define proc_getpgrp   rb_f_notimplement

Definition at line 4277 of file process.c.

Referenced by Init_process().

◆ proc_getpriority

#define proc_getpriority   rb_f_notimplement

Definition at line 4488 of file process.c.

Referenced by Init_process().

◆ proc_getrlimit

#define proc_getrlimit   rb_f_notimplement

Definition at line 4756 of file process.c.

Referenced by Init_process().

◆ proc_getsid

#define proc_getsid   rb_f_notimplement

Definition at line 4392 of file process.c.

Referenced by Init_process().

◆ proc_initgroups

#define proc_initgroups   rb_f_notimplement

Definition at line 5783 of file process.c.

Referenced by Init_process().

◆ proc_setegid_m

#define proc_setegid_m   rb_f_notimplement

Definition at line 6302 of file process.c.

Referenced by Init_process().

◆ proc_seteuid_m

#define proc_seteuid_m   rb_f_notimplement

Definition at line 6172 of file process.c.

Referenced by Init_process().

◆ proc_setgid

#define proc_setgid   rb_f_notimplement

Definition at line 5613 of file process.c.

Referenced by Init_process().

◆ proc_setgroups

#define proc_setgroups   rb_f_notimplement

Definition at line 5752 of file process.c.

Referenced by Init_process().

◆ proc_setmaxgroups

#define proc_setmaxgroups   rb_f_notimplement

Definition at line 5835 of file process.c.

Referenced by Init_process().

◆ proc_setpgid

#define proc_setpgid   rb_f_notimplement

Definition at line 4358 of file process.c.

Referenced by Init_process().

◆ proc_setpgrp

#define proc_setpgrp   rb_f_notimplement

Definition at line 4306 of file process.c.

Referenced by Init_process().

◆ proc_setpriority

#define proc_setpriority   rb_f_notimplement

Definition at line 4520 of file process.c.

Referenced by Init_process().

◆ proc_setrlimit

#define proc_setrlimit   rb_f_notimplement

Definition at line 4832 of file process.c.

Referenced by Init_process().

◆ proc_setsid

#define proc_setsid   rb_f_notimplement

Definition at line 4451 of file process.c.

Referenced by Init_process().

◆ proc_setuid

#define proc_setuid   rb_f_notimplement

Definition at line 5202 of file process.c.

Referenced by Init_process().

◆ PST2INT

#define PST2INT (   st)    NUM2INT(pst_to_i(st))

◆ rb_f_fork

#define rb_f_fork   rb_f_notimplement

Definition at line 3601 of file process.c.

Referenced by Init_process().

◆ rb_intern

#define rb_intern (   str)    rb_intern_const(str)

◆ rb_proc_times

#define rb_proc_times   rb_f_notimplement

Definition at line 6773 of file process.c.

Referenced by Init_process().

◆ redirect_close

#define redirect_close (   fd)    close(fd)

Definition at line 2574 of file process.c.

Referenced by run_exec_close(), run_exec_dup2(), and run_exec_open().

◆ redirect_dup

#define redirect_dup (   oldfd)    dup(oldfd)

Definition at line 2572 of file process.c.

Referenced by run_exec_dup2(), and save_redirect_fd().

◆ redirect_dup2

#define redirect_dup2 (   oldfd,
  newfd 
)    dup2((oldfd), (newfd))

Definition at line 2573 of file process.c.

Referenced by run_exec_dup2(), run_exec_dup2_child(), and run_exec_open().

◆ redirect_open

#define redirect_open (   pathname,
  flags,
  perm 
)    open((pathname), (flags), (perm))

Definition at line 2575 of file process.c.

Referenced by run_exec_open().

◆ RUBY_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID

#define RUBY_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID   ID2SYM(rb_intern("CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID"))

◆ RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME

#define RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME   ID2SYM(rb_intern("GETTIMEOFDAY_BASED_CLOCK_REALTIME"))

◆ RUBY_TIME_BASED_CLOCK_REALTIME

#define RUBY_TIME_BASED_CLOCK_REALTIME   ID2SYM(rb_intern("TIME_BASED_CLOCK_REALTIME"))

◆ TIMETICK_INT2NUM

#define TIMETICK_INT2NUM (   v)    LONG2NUM(v)

Definition at line 6785 of file process.c.

Referenced by timetick2integer().

◆ TIMETICK_INT_MAX

#define TIMETICK_INT_MAX   LONG_MAX

Definition at line 6784 of file process.c.

Referenced by timetick2integer().

◆ TIMETICK_INT_MIN

#define TIMETICK_INT_MIN   LONG_MIN

Definition at line 6783 of file process.c.

Referenced by timetick2integer().

◆ try_with_sh

#define try_with_sh (   prog,
  argv,
  envp 
)    (void)0

Definition at line 1196 of file process.c.

Referenced by proc_exec_cmd(), and proc_exec_v().

◆ USE_SPAWNV

#define USE_SPAWNV   0

Definition at line 1432 of file process.c.

◆ WEXITSTATUS

#define WEXITSTATUS (   w)    (((w) >> 8) & 0xff)

Definition at line 109 of file process.c.

Referenced by pst_message(), pst_success_p(), and pst_wexitstatus().

◆ WIFEXITED

#define WIFEXITED (   w)    (((w) & 0xff) == 0)

Definition at line 100 of file process.c.

Referenced by pst_message(), pst_success_p(), pst_wexitstatus(), and pst_wifexited().

◆ WIFSIGNALED

#define WIFSIGNALED (   w)    (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))

Definition at line 103 of file process.c.

Referenced by pst_message(), pst_wifsignaled(), and pst_wtermsig().

◆ WIFSTOPPED

#define WIFSTOPPED (   w)    (((w) & 0xff) == 0x7f)

Definition at line 106 of file process.c.

Referenced by pst_message(), pst_wifstopped(), and pst_wstopsig().

◆ WSTOPSIG

#define WSTOPSIG   WEXITSTATUS

Definition at line 115 of file process.c.

Referenced by pst_message(), and pst_wstopsig().

◆ WTERMSIG

#define WTERMSIG (   w)    ((w) & 0x7f)

Definition at line 112 of file process.c.

Referenced by pst_message(), and pst_wtermsig().

Typedef Documentation

◆ timetick_int_t

typedef long timetick_int_t

Definition at line 6782 of file process.c.

◆ unsigned_clock_t

typedef unsigned int unsigned_clock_t

Definition at line 239 of file process.c.

Function Documentation

◆ after_exec()

static void after_exec ( void  )
static

Definition at line 1159 of file process.c.

References after_exec_async_signal_safe(), and after_exec_non_async_signal_safe().

Referenced by proc_exec_v(), and rb_proc_exec().

◆ after_exec_async_signal_safe()

static void after_exec_async_signal_safe ( void  )
static

Definition at line 1142 of file process.c.

References signal().

Referenced by after_exec(), and rb_exec_async_signal_safe().

◆ after_exec_non_async_signal_safe()

static void after_exec_non_async_signal_safe ( void  )
static

◆ before_exec()

static void before_exec ( void  )
static

Definition at line 1134 of file process.c.

References before_exec_async_signal_safe(), and before_exec_non_async_signal_safe().

Referenced by proc_exec_v(), and rb_proc_exec().

◆ before_exec_async_signal_safe()

static void before_exec_async_signal_safe ( void  )
static

Definition at line 1105 of file process.c.

References signal().

Referenced by before_exec(), and rb_exec_async_signal_safe().

◆ before_exec_non_async_signal_safe()

static void before_exec_non_async_signal_safe ( void  )
static

Definition at line 1119 of file process.c.

References forked_child, and rb_thread_stop_timer_thread().

Referenced by before_exec(), and rb_exec_without_timer_thread().

◆ check_exec_env_i()

static int check_exec_env_i ( st_data_t  st_key,
st_data_t  st_val,
st_data_t  arg 
)
static

◆ check_exec_fds()

static VALUE check_exec_fds ( struct rb_execarg eargp)
static

◆ check_exec_fds_1()

static int check_exec_fds_1 ( struct rb_execarg eargp,
VALUE  h,
int  maxhint,
VALUE  ary 
)
static

◆ check_exec_options_i()

static int check_exec_options_i ( st_data_t  st_key,
st_data_t  st_val,
st_data_t  arg 
)
static

Definition at line 1844 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().

◆ check_exec_options_i_extract()

static int check_exec_options_i_extract ( st_data_t  st_key,
st_data_t  st_val,
st_data_t  arg 
)
static

Definition at line 1859 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().

◆ check_exec_redirect()

static void check_exec_redirect ( VALUE  key,
VALUE  val,
struct rb_execarg eargp 
)
static

◆ check_exec_redirect1()

static VALUE check_exec_redirect1 ( VALUE  ary,
VALUE  key,
VALUE  param 
)
static

◆ check_exec_redirect_fd()

static VALUE check_exec_redirect_fd ( VALUE  v,
int  iskey 
)
static

◆ check_gid_switch()

static void check_gid_switch ( void  )
static

◆ check_uid_switch()

static void check_uid_switch ( void  )
static

◆ compare_posix_sh()

static int compare_posix_sh ( const void *  key,
const void *  el 
)
static

Definition at line 2075 of file process.c.

References key, string_part::len, and string_part::ptr.

Referenced by rb_exec_fillarg().

◆ detach_process_pid()

static VALUE detach_process_pid ( VALUE  thread)
static

Definition at line 1009 of file process.c.

References id_pid(), and rb_thread_local_aref().

Referenced by rb_detach_process().

◆ detach_process_watcher()

static VALUE detach_process_watcher ( void *  arg)
static

Definition at line 1015 of file process.c.

References wait_data::pid, rb_last_status_get(), rb_waitpid(), and wait_data::status.

Referenced by rb_detach_process().

◆ exit_status_code()

static int exit_status_code ( VALUE  status)
static

Definition at line 3605 of file process.c.

References EXIT_FAILURE, EXIT_SUCCESS, NUM2INT, Qfalse, and Qtrue.

Referenced by rb_f_exit(), and rb_f_exit_bang().

◆ fill_envp_buf_i()

static int fill_envp_buf_i ( st_data_t  st_key,
st_data_t  st_val,
st_data_t  arg 
)
static

◆ free_exec_arg()

static void free_exec_arg ( void *  ptr)
static

Definition at line 1394 of file process.c.

References xfree().

◆ gcd_timetick_int()

static timetick_int_t gcd_timetick_int ( timetick_int_t  a,
timetick_int_t  b 
)
static

Definition at line 6789 of file process.c.

References t().

Referenced by reduce_fraction().

◆ get_pid()

static VALUE get_pid ( void  )
static

Definition at line 257 of file process.c.

References PIDT2NUM, and rb_secure().

Referenced by Init_process().

◆ get_ppid()

static VALUE get_ppid ( void  )
static

Definition at line 281 of file process.c.

References PIDT2NUM, and rb_secure().

Referenced by Init_process().

◆ hide_obj()

static VALUE hide_obj ( VALUE  obj)
static

◆ id_pid()

static ID id_pid ( void  )
inlinestatic

Definition at line 1001 of file process.c.

References CONST_ID, and wait_data::pid.

Referenced by detach_process_pid(), and rb_detach_process().

◆ Init_process()

void Init_process ( void  )

Definition at line 7414 of file process.c.

References CLASS_OF, CLOCK_MONOTONIC, CLOCK_REALTIME, 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_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_mProcess, rb_mProcGID, rb_mProcID_Syscall, rb_mProcUID, rb_proc_times, rb_singleton_class(), rb_struct_define_under(), rb_undef_method(), RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME, SAVED_GROUP_ID, SAVED_USER_ID, and WNOHANG.

◆ intcmp()

static int intcmp ( const void *  a,
const void *  b 
)
static

Definition at line 2611 of file process.c.

Referenced by run_exec_dup2().

◆ intrcmp()

static int intrcmp ( const void *  a,
const void *  b 
)
static

Definition at line 2617 of file process.c.

Referenced by run_exec_dup2().

◆ make_clock_result()

static VALUE make_clock_result ( struct timetick ttp,
timetick_int_t numerators,
int  num_numerators,
timetick_int_t denominators,
int  num_denominators,
VALUE  unit 
)
static

◆ mark_exec_arg()

static void mark_exec_arg ( void *  ptr)
static

◆ memsize_exec_arg()

static size_t memsize_exec_arg ( const void *  ptr)
static

Definition at line 1400 of file process.c.

◆ p_gid_change_privilege()

static VALUE p_gid_change_privilege ( VALUE  obj,
VALUE  id 
)
static

◆ p_gid_exchange()

static VALUE p_gid_exchange ( VALUE  obj)
static

◆ p_gid_exchangeable()

static VALUE p_gid_exchangeable ( void  )
static

Definition at line 6439 of file process.c.

References Qfalse, and Qtrue.

Referenced by Init_process().

◆ p_gid_grant_privilege()

static VALUE p_gid_grant_privilege ( VALUE  obj,
VALUE  id 
)
static

Definition at line 6360 of file process.c.

References id, OBJ2GID, and rb_setegid_core().

Referenced by Init_process().

◆ p_gid_have_saved_id()

static VALUE p_gid_have_saved_id ( void  )
static

Definition at line 6618 of file process.c.

References Qfalse, and Qtrue.

Referenced by Init_process().

◆ p_gid_sw_ensure()

static VALUE p_gid_sw_ensure ( VALUE  obj)
static

Definition at line 6689 of file process.c.

References p_gid_exchange(), and under_gid_switch.

Referenced by p_gid_switch().

◆ p_gid_switch()

static VALUE p_gid_switch ( VALUE  obj)
static

◆ p_uid_change_privilege()

static VALUE p_uid_change_privilege ( VALUE  obj,
VALUE  id 
)
static

◆ p_uid_exchange()

static VALUE p_uid_exchange ( VALUE  obj)
static

◆ p_uid_exchangeable()

static VALUE p_uid_exchangeable ( void  )
static

Definition at line 6377 of file process.c.

References Qfalse, and Qtrue.

Referenced by Init_process().

◆ p_uid_grant_privilege()

static VALUE p_uid_grant_privilege ( VALUE  obj,
VALUE  id 
)
static

Definition at line 6230 of file process.c.

References id, OBJ2UID, and rb_seteuid_core().

Referenced by Init_process().

◆ p_uid_have_saved_id()

static VALUE p_uid_have_saved_id ( void  )
static

Definition at line 6502 of file process.c.

References Qfalse, and Qtrue.

Referenced by Init_process().

◆ p_uid_sw_ensure()

static VALUE p_uid_sw_ensure ( VALUE  obj)
static

Definition at line 6574 of file process.c.

References p_uid_exchange(), and under_uid_switch.

Referenced by p_uid_switch().

◆ p_uid_switch()

static VALUE p_uid_switch ( VALUE  obj)
static

◆ proc_detach()

static VALUE proc_detach ( VALUE  obj,
VALUE  pid 
)
static

Definition at line 1084 of file process.c.

References NUM2PIDT, wait_data::pid, rb_detach_process(), and rb_secure().

Referenced by Init_process().

◆ proc_exec_cmd()

static int proc_exec_cmd ( const char *  prog,
VALUE  argv_str,
VALUE  envp_str 
)
static

◆ proc_exec_sh()

static int proc_exec_sh ( const char *  str,
VALUE  envp_str 
)
static

◆ proc_exec_v()

static int proc_exec_v ( char **  argv,
const char *  prog 
)
static

◆ proc_getegid()

static VALUE proc_getegid ( VALUE  obj)
static

Definition at line 6250 of file process.c.

References getegid(), and GIDT2NUM.

Referenced by Init_process().

◆ proc_geteuid()

static VALUE proc_geteuid ( VALUE  obj)
static

Definition at line 6126 of file process.c.

References geteuid(), and UIDT2NUM.

Referenced by Init_process().

◆ proc_getgid()

static VALUE proc_getgid ( VALUE  obj)
static

Definition at line 5571 of file process.c.

References getgid(), and GIDT2NUM.

Referenced by Init_process().

◆ proc_getuid()

static VALUE proc_getuid ( VALUE  obj)
static

Definition at line 5159 of file process.c.

References getuid(), and UIDT2NUM.

Referenced by Init_process().

◆ proc_wait()

static VALUE proc_wait ( int  argc,
VALUE argv 
)
static

◆ proc_wait2()

static VALUE proc_wait2 ( int  argc,
VALUE argv 
)
static

Definition at line 930 of file process.c.

References argc, argv, NIL_P, wait_data::pid, proc_wait(), Qnil, rb_assoc_new(), and rb_last_status_get().

Referenced by Init_process().

◆ proc_waitall()

static VALUE proc_waitall ( void  )
static

◆ pst_bitand()

static VALUE pst_bitand ( VALUE  st1,
VALUE  st2 
)
static

Definition at line 502 of file process.c.

References INT2NUM, NUM2INT, and PST2INT.

Referenced by Init_process().

◆ pst_equal()

static VALUE pst_equal ( VALUE  st1,
VALUE  st2 
)
static

Definition at line 482 of file process.c.

References pst_to_i(), Qtrue, and rb_equal().

Referenced by Init_process().

◆ pst_inspect()

static VALUE pst_inspect ( VALUE  st)
static

Definition at line 453 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 Init_process().

◆ pst_message()

static void pst_message ( VALUE  str,
rb_pid_t  pid,
int  status 
)
static

◆ pst_pid()

static VALUE pst_pid ( VALUE  st)
static

Definition at line 374 of file process.c.

References rb_attr_get(), and rb_intern.

Referenced by Init_process(), pst_inspect(), and pst_to_s().

◆ pst_rshift()

static VALUE pst_rshift ( VALUE  st1,
VALUE  st2 
)
static

Definition at line 523 of file process.c.

References INT2NUM, NUM2INT, and PST2INT.

Referenced by Init_process().

◆ pst_success_p()

static VALUE pst_success_p ( VALUE  st)
static

Definition at line 671 of file process.c.

References EXIT_SUCCESS, PST2INT, Qfalse, Qnil, Qtrue, WEXITSTATUS, and WIFEXITED.

Referenced by Init_process().

◆ pst_to_i()

static VALUE pst_to_i ( VALUE  st)
static

Definition at line 355 of file process.c.

References rb_iv_get().

Referenced by Init_process(), and pst_equal().

◆ pst_to_s()

static VALUE pst_to_s ( VALUE  st)
static

Definition at line 426 of file process.c.

References NUM2PIDT, PST2INT, pst_message(), pst_pid(), and rb_str_buf_new().

Referenced by Init_process().

◆ pst_wcoredump()

static VALUE pst_wcoredump ( VALUE  st)
static

Definition at line 690 of file process.c.

References PST2INT, Qfalse, and Qtrue.

Referenced by Init_process().

◆ pst_wexitstatus()

static VALUE pst_wexitstatus ( VALUE  st)
static

Definition at line 652 of file process.c.

References INT2NUM, PST2INT, Qnil, WEXITSTATUS, and WIFEXITED.

Referenced by Init_process().

◆ pst_wifexited()

static VALUE pst_wifexited ( VALUE  st)
static

Definition at line 621 of file process.c.

References PST2INT, Qfalse, Qtrue, and WIFEXITED.

Referenced by Init_process().

◆ pst_wifsignaled()

static VALUE pst_wifsignaled ( VALUE  st)
static

Definition at line 580 of file process.c.

References PST2INT, Qfalse, Qtrue, and WIFSIGNALED.

Referenced by Init_process().

◆ pst_wifstopped()

static VALUE pst_wifstopped ( VALUE  st)
static

Definition at line 541 of file process.c.

References PST2INT, Qfalse, Qtrue, and WIFSTOPPED.

Referenced by Init_process().

◆ pst_wstopsig()

static VALUE pst_wstopsig ( VALUE  st)
static

Definition at line 561 of file process.c.

References INT2NUM, PST2INT, Qnil, WIFSTOPPED, and WSTOPSIG.

Referenced by Init_process().

◆ pst_wtermsig()

static VALUE pst_wtermsig ( VALUE  st)
static

Definition at line 601 of file process.c.

References INT2NUM, PST2INT, Qnil, WIFSIGNALED, and WTERMSIG.

Referenced by Init_process().

◆ rb_check_argv()

static VALUE rb_check_argv ( int  argc,
VALUE argv 
)
static

◆ rb_check_exec_env()

static VALUE rb_check_exec_env ( VALUE  hash)
static

◆ rb_check_exec_options()

static void rb_check_exec_options ( VALUE  opthash,
VALUE  execarg_obj 
)
static

Definition at line 1952 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().

◆ rb_clock_getres()

VALUE rb_clock_getres ( int  argc,
VALUE argv 
)

◆ rb_clock_gettime()

VALUE rb_clock_gettime ( int  argc,
VALUE argv 
)

◆ rb_detach_process()

VALUE rb_detach_process ( rb_pid_t  pid)

◆ rb_exec()

int rb_exec ( const struct rb_exec_arg e)

◆ rb_exec_arg_addopt()

int rb_exec_arg_addopt ( struct rb_exec_arg e,
VALUE  key,
VALUE  val 
)

Definition at line 1838 of file process.c.

References rb_exec_arg::execarg_obj, key, rb_execarg_addopt(), and val.

◆ rb_exec_arg_fixup()

void rb_exec_arg_fixup ( struct rb_exec_arg e)

Definition at line 2402 of file process.c.

References rb_exec_arg::execarg_obj, and rb_execarg_fixup().

◆ rb_exec_arg_init()

VALUE rb_exec_arg_init ( int  argc,
VALUE argv,
int  accept_shell,
struct rb_exec_arg e 
)

Definition at line 2294 of file process.c.

References argc, argv, rb_exec_arg::execarg_obj, and rb_execarg_init().

◆ rb_exec_async_signal_safe()

int rb_exec_async_signal_safe ( const struct rb_execarg eargp,
char *  errmsg,
size_t  errmsg_buflen 
)

◆ rb_exec_err()

int rb_exec_err ( const struct rb_exec_arg e,
char *  errmsg,
size_t  errmsg_buflen 
)

◆ rb_exec_fillarg()

static void rb_exec_fillarg ( VALUE  prog,
int  argc,
VALUE argv,
VALUE  env,
VALUE  opthash,
VALUE  execarg_obj 
)
static

◆ rb_exec_getargs()

static VALUE rb_exec_getargs ( int *  argc_p,
VALUE **  argv_p,
int  accept_shell,
VALUE env_ret,
VALUE opthash_ret 
)
static

Definition at line 2037 of file process.c.

References hash(), NIL_P, rb_check_argv(), and rb_check_hash_type().

Referenced by rb_execarg_init().

◆ rb_exec_without_timer_thread()

static int rb_exec_without_timer_thread ( const struct rb_execarg eargp,
char *  errmsg,
size_t  errmsg_buflen 
)
static

◆ rb_execarg_addopt()

int rb_execarg_addopt ( VALUE  execarg_obj,
VALUE  key,
VALUE  val 
)

◆ rb_execarg_extract_options()

VALUE rb_execarg_extract_options ( VALUE  execarg_obj,
VALUE  opthash 
)

◆ rb_execarg_fixup()

void rb_execarg_fixup ( VALUE  execarg_obj)

◆ rb_execarg_get()

struct rb_execarg* rb_execarg_get ( VALUE  execarg_obj)

◆ rb_execarg_init()

VALUE rb_execarg_init ( int  argc,
VALUE argv,
int  accept_shell,
VALUE  execarg_obj 
)

◆ rb_execarg_new()

VALUE rb_execarg_new ( int  argc,
VALUE argv,
int  accept_shell 
)

◆ rb_execarg_run_options()

int rb_execarg_run_options ( const struct rb_execarg eargp,
struct rb_execarg sargp,
char *  errmsg,
size_t  errmsg_buflen 
)

◆ rb_execarg_setenv()

void rb_execarg_setenv ( VALUE  execarg_obj,
VALUE  env 
)

Definition at line 2300 of file process.c.

References env, rb_execarg::env_modification, NIL_P, Qfalse, rb_check_exec_env(), and rb_execarg_get().

Referenced by rb_io_s_popen().

◆ rb_exit()

void rb_exit ( int  status)

◆ rb_f_abort()

VALUE rb_f_abort ( int  argc,
VALUE argv 
)

◆ rb_f_exec()

VALUE rb_f_exec ( int  argc,
VALUE argv 
)

◆ rb_f_exit()

VALUE rb_f_exit ( int  argc,
VALUE argv 
)

Definition at line 3712 of file process.c.

References argc, argv, exit_status_code(), EXIT_SUCCESS, rb_exit(), rb_scan_args(), and UNREACHABLE.

Referenced by Init_process().

◆ rb_f_exit_bang()

static VALUE rb_f_exit_bang ( int  argc,
VALUE argv,
VALUE  obj 
)
static

Definition at line 3639 of file process.c.

References argc, argv, EXIT_FAILURE, exit_status_code(), rb_scan_args(), and UNREACHABLE.

Referenced by Init_process().

◆ rb_f_sleep()

static VALUE rb_f_sleep ( int  argc,
VALUE argv 
)
static

◆ rb_f_spawn()

static VALUE rb_f_spawn ( int  argc,
VALUE argv 
)
static

◆ rb_f_system()

static VALUE rb_f_system ( int  argc,
VALUE argv 
)
static

◆ rb_last_status_clear()

void rb_last_status_clear ( void  )

◆ rb_last_status_get()

VALUE rb_last_status_get ( void  )

◆ rb_last_status_set()

void rb_last_status_set ( int  status,
rb_pid_t  pid 
)

◆ rb_proc_exec()

int rb_proc_exec ( const char *  str)

Definition at line 1359 of file process.c.

References after_exec(), before_exec(), preserving_errno, proc_exec_sh(), and Qfalse.

◆ rb_proc_exec_n()

int rb_proc_exec_n ( int  argc,
VALUE argv,
const char *  prog 
)

Definition at line 1285 of file process.c.

References ALLOC_ARGV, ALLOCV_END, argc, argv, proc_exec_v(), and RSTRING_PTR.

◆ rb_run_exec_options()

int rb_run_exec_options ( const struct rb_exec_arg e,
struct rb_exec_arg s 
)

Definition at line 3106 of file process.c.

References rb_exec_arg::execarg_obj, NULL, rb_execarg_get(), and rb_execarg_run_options().

◆ rb_run_exec_options_err()

int rb_run_exec_options_err ( const struct rb_exec_arg e,
struct rb_exec_arg s,
char *  errmsg,
size_t  errmsg_buflen 
)

Definition at line 3100 of file process.c.

References rb_exec_arg::execarg_obj, rb_execarg_get(), and rb_execarg_run_options().

◆ rb_setegid_core()

static rb_gid_t rb_setegid_core ( rb_gid_t  egid)
static

◆ rb_seteuid_core()

static rb_uid_t rb_seteuid_core ( rb_uid_t  euid)
static

◆ rb_spawn()

rb_pid_t rb_spawn ( int  argc,
VALUE argv 
)

Definition at line 3842 of file process.c.

References argc, argv, NULL, and rb_spawn_internal().

◆ rb_spawn_err()

rb_pid_t rb_spawn_err ( int  argc,
VALUE argv,
char *  errmsg,
size_t  errmsg_buflen 
)

Definition at line 3836 of file process.c.

References argc, argv, and rb_spawn_internal().

◆ rb_spawn_internal()

static rb_pid_t rb_spawn_internal ( int  argc,
VALUE argv,
char *  errmsg,
size_t  errmsg_buflen 
)
static

◆ rb_spawn_process()

static rb_pid_t rb_spawn_process ( struct rb_execarg eargp,
char *  errmsg,
size_t  errmsg_buflen 
)
static

◆ rb_syswait()

void rb_syswait ( rb_pid_t  pid)

Definition at line 3763 of file process.c.

References rb_waitpid().

Referenced by rb_io_close().

◆ rb_waitpid()

rb_pid_t rb_waitpid ( rb_pid_t  pid,
int *  st,
int  flags 
)

◆ rb_waitpid_blocking()

static void* rb_waitpid_blocking ( void *  data)
static

Definition at line 739 of file process.c.

References NULL, result, wait(), and waitpid().

Referenced by rb_waitpid().

◆ reduce_factors()

static void reduce_factors ( timetick_int_t numerators,
int  num_numerators,
timetick_int_t denominators,
int  num_denominators 
)
static

Definition at line 6819 of file process.c.

References reduce_fraction().

Referenced by timetick2dblnum(), timetick2dblnum_reciprocal(), and timetick2integer().

◆ reduce_fraction()

static void reduce_fraction ( timetick_int_t np,
timetick_int_t dp 
)
static

Definition at line 6809 of file process.c.

References dp, and gcd_timetick_int().

Referenced by reduce_factors().

◆ run_exec_close()

static int run_exec_close ( VALUE  ary,
char *  errmsg,
size_t  errmsg_buflen 
)
static

Definition at line 2769 of file process.c.

References ERRMSG, FIX2INT, RARRAY_AREF, RARRAY_LEN, and redirect_close.

Referenced by rb_execarg_run_options().

◆ run_exec_dup2()

static int run_exec_dup2 ( VALUE  ary,
VALUE  tmpbuf,
struct rb_execarg sargp,
char *  errmsg,
size_t  errmsg_buflen 
)
static

◆ run_exec_dup2_child()

static int run_exec_dup2_child ( VALUE  ary,
struct rb_execarg sargp,
char *  errmsg,
size_t  errmsg_buflen 
)
static

◆ run_exec_dup2_tmpbuf_size()

static long run_exec_dup2_tmpbuf_size ( long  n)
static

Definition at line 2630 of file process.c.

Referenced by rb_execarg_fixup(), and rb_execarg_run_options().

◆ run_exec_open()

static int run_exec_open ( VALUE  ary,
struct rb_execarg sargp,
char *  errmsg,
size_t  errmsg_buflen 
)
static

◆ save_env()

static void save_env ( struct rb_execarg sargp)
static

◆ save_env_i()

static VALUE save_env_i ( RB_BLOCK_CALL_FUNC_ARGLIST(i, ary)  )
static

Definition at line 2934 of file process.c.

References argv, hide_obj(), Qnil, rb_ary_dup(), and rb_ary_push().

Referenced by save_env().

◆ save_redirect_fd()

static int save_redirect_fd ( int  fd,
struct rb_execarg sargp,
char *  errmsg,
size_t  errmsg_buflen 
)
static

◆ security()

static void security ( const char *  str)
static

Definition at line 1171 of file process.c.

References rb_env_path_tainted(), rb_eSecurityError, rb_raise(), and rb_safe_level.

Referenced by rb_check_argv().

◆ timetick2dblnum()

static VALUE timetick2dblnum ( struct timetick ttp,
timetick_int_t numerators,
int  num_numerators,
timetick_int_t denominators,
int  num_denominators 
)
static

Definition at line 6840 of file process.c.

References timetick::count, DBL2NUM, timetick::giga_count, and reduce_factors().

Referenced by make_clock_result().

◆ timetick2dblnum_reciprocal()

static VALUE timetick2dblnum_reciprocal ( struct timetick ttp,
timetick_int_t numerators,
int  num_numerators,
timetick_int_t denominators,
int  num_denominators 
)
static

Definition at line 6861 of file process.c.

References timetick::count, DBL2NUM, timetick::giga_count, and reduce_factors().

Referenced by rb_clock_getres().

◆ timetick2integer()

static VALUE timetick2integer ( struct timetick ttp,
timetick_int_t numerators,
int  num_numerators,
timetick_int_t denominators,
int  num_denominators 
)
static

◆ wait_each()

static int wait_each ( rb_pid_t  pid,
int  status,
struct wait_data data 
)
static

Definition at line 714 of file process.c.

References wait_data::pid, ST_DELETE, ST_STOP, and wait_data::status.

Referenced by rb_waitpid().

◆ waitall_each()

static int waitall_each ( rb_pid_t  pid,
int  status,
VALUE  ary 
)
static

Definition at line 724 of file process.c.

References PIDT2NUM, rb_ary_push(), rb_assoc_new(), rb_last_status_get(), rb_last_status_set(), and ST_DELETE.

Referenced by proc_waitall().

Variable Documentation

◆ exec_arg_data_type

const rb_data_type_t exec_arg_data_type
static
Initial value:
= {
"exec_arg",
}
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1015
static void mark_exec_arg(void *ptr)
Definition: process.c:1369
static size_t memsize_exec_arg(const void *ptr)
Definition: process.c:1400
static void free_exec_arg(void *ptr)
Definition: process.c:1394
#define NULL
Definition: _sdbm.c:102

Definition at line 1405 of file process.c.

Referenced by rb_execarg_get(), and rb_execarg_new().

◆ forked_child

int forked_child = 0
static

◆ pid_tbl

st_table* pid_tbl
static

Definition at line 706 of file process.c.

Referenced by proc_waitall(), and rb_waitpid().

◆ rb_cProcessStatus

VALUE rb_cProcessStatus
static

Definition at line 318 of file process.c.

Referenced by Init_process(), and rb_last_status_set().

◆ rb_mProcess

VALUE rb_mProcess

Definition at line 7402 of file process.c.

Referenced by Init_process().

◆ rb_mProcGID

VALUE rb_mProcGID

Definition at line 7404 of file process.c.

Referenced by Init_process().

◆ rb_mProcID_Syscall

VALUE rb_mProcID_Syscall

Definition at line 7405 of file process.c.

Referenced by Init_process().

◆ rb_mProcUID

VALUE rb_mProcUID

Definition at line 7403 of file process.c.

Referenced by Init_process().

◆ SAVED_GROUP_ID

rb_gid_t SAVED_GROUP_ID = -1
static

Definition at line 5924 of file process.c.

Referenced by Init_process(), p_gid_change_privilege(), p_gid_exchange(), and rb_setegid_core().

◆ SAVED_USER_ID

rb_uid_t SAVED_USER_ID = -1
static

Definition at line 5216 of file process.c.

Referenced by Init_process(), p_uid_change_privilege(), p_uid_exchange(), and rb_seteuid_core().

◆ under_gid_switch

int under_gid_switch = 0
static

Definition at line 4845 of file process.c.

Referenced by check_gid_switch(), p_gid_sw_ensure(), and p_gid_switch().

◆ under_uid_switch

int under_uid_switch = 0
static

Definition at line 4835 of file process.c.

Referenced by check_uid_switch(), p_uid_sw_ensure(), and p_uid_switch().