Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Defines | Enumerations | Functions | Variables

# process.c File Reference

`#include "ruby/ruby.h"`
`#include "ruby/io.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"`
Include dependency graph for process.c:

Go to the source code of this file.

## Data Structures
struct | wait_data
## Defines
#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 | RLIM2NUM(v) UINT2NUM(v)
#define | NUM2RLIM(v) NUM2UINT(v)
#define | preserving_errno(stmts) do {int saved_errno = errno; stmts; errno = saved_errno;} while (0)
#define | PST2INT(st) NUM2INT(pst_to_i(st))
#define | NO_WAITPID
#define | before_exec() (rb_enable_interrupt(), (forked_child ? 0 : (rb_thread_stop_timer_thread(), 1)))
#define | after_exec() (rb_thread_reset_timer_thread(), rb_thread_start_timer_thread(), forked_child = 0, rb_disable_interrupt())
#define | before_fork() before_exec()
#define | after_fork() (GET_THREAD()->thrown_errinfo = 0, after_exec())
#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_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_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
## Enumerations
enum | { EXEC_OPTION_PGROUP, EXEC_OPTION_RLIMIT, EXEC_OPTION_UNSETENV_OTHERS, EXEC_OPTION_ENV, EXEC_OPTION_CHDIR, EXEC_OPTION_UMASK, EXEC_OPTION_DUP2, EXEC_OPTION_CLOSE, EXEC_OPTION_OPEN, EXEC_OPTION_DUP2_CHILD, EXEC_OPTION_CLOSE_OTHERS }
## Functions
struct timeval | rb_time_interval (VALUE)
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)
static 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 VALUE | 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)
char * | strtok ()
void | rb_thread_stop_timer_thread (void)
void | rb_thread_start_timer_thread (void)
void | rb_thread_reset_timer_thread (void)
static void | security (const char *str)
static int | proc_exec_v (char **argv, const char *prog)
int | rb_proc_exec_n (int argc, VALUE *argv, const char *prog)
int | rb_proc_exec (const char *str)
static VALUE | hide_obj (VALUE obj)
static VALUE | check_exec_redirect_fd (VALUE v)
static void | check_exec_redirect (VALUE key, VALUE val, VALUE options)
static int | rlimit_type_by_lname (const char *name)
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 VALUE | check_exec_fds (VALUE options)
static void | rb_check_exec_options (VALUE opthash, struct rb_exec_arg *e)
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, struct rb_exec_arg *e)
static void | rb_exec_fillarg (VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, struct rb_exec_arg *e)
VALUE | rb_exec_arg_init (int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
void | rb_exec_arg_fixup (struct rb_exec_arg *e)
VALUE | rb_f_exec (int argc, VALUE *argv)
static int | save_redirect_fd (int fd, VALUE save, char *errmsg, size_t errmsg_buflen)
static VALUE | save_env_i (VALUE i, VALUE ary, int argc, VALUE *argv)
static void | save_env (VALUE save)
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 save, 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, VALUE save, char *errmsg, size_t errmsg_buflen)
static int | run_exec_dup2_child (VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
static int | run_exec_rlimit (VALUE ary, VALUE save, 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_err (const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
int | rb_exec (const struct rb_exec_arg *e)
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 VALUE | rb_exec_arg_prepare (struct rb_exec_arg *earg, int argc, VALUE *argv, int default_close_others)
static rb_pid_t | rb_spawn_process (struct rb_exec_arg *earg, VALUE prog, char *errmsg, size_t errmsg_buflen)
static rb_pid_t | rb_spawn_internal (int argc, VALUE *argv, int default_close_others, 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 int | rlimit_resource_name2int (const char *name, int casetype)
static int | rlimit_type_by_hname (const char *name)
static int | rlimit_resource_type (VALUE rtype)
static rlim_t | rlimit_resource_value (VALUE rval)
static void | check_uid_switch (void)
static void | check_gid_switch (void)
static VALUE | proc_getuid (VALUE obj)
static VALUE | p_uid_change_privilege (VALUE obj, VALUE id)
static VALUE | proc_getgid (VALUE obj)
static VALUE | proc_getmaxgroups (VALUE obj)
static VALUE | proc_setmaxgroups (VALUE obj, VALUE val)
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)
void | Init_process (void)
## Variables
static VALUE | rb_cProcessStatus
static st_table * | pid_tbl
static int | forked_child = 0
static int | under_uid_switch = 0
static int | under_gid_switch = 0
static rb_uid_t | SAVED_USER_ID = -1
static int | maxgroups = 32
static rb_gid_t | SAVED_GROUP_ID = -1
VALUE | rb_mProcess
VALUE | rb_mProcUID
VALUE | rb_mProcGID
VALUE | rb_mProcID_Syscall

## Define Documentation

#define after_exec | ( |  | ) | (rb_thread_reset_timer_thread(), rb_thread_start_timer_thread(), forked_child = 0, rb_disable_interrupt())

Definition at line 989 of file process.c.

Referenced by proc_exec_v(), and rb_proc_exec().

#define after_fork | ( |  | ) | (GET_THREAD()->thrown_errinfo = 0, after_exec())

Definition at line 992 of file process.c.

#define before_exec | ( |  | ) | (rb_enable_interrupt(), (forked_child ? 0 : (rb_thread_stop_timer_thread(), 1)))

Definition at line 987 of file process.c.

Referenced by proc_exec_v(), and rb_proc_exec().

#define before_fork | ( |  | ) | before_exec()

Definition at line 991 of file process.c.

#define CHILD_ERRMSG_BUFLEN 80

Referenced by rb_f_exec(), and rb_f_spawn().

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

Definition at line 1788 of file process.c.

Referenced by rb_run_exec_options_err(), run_exec_close(), run_exec_dup2(), run_exec_dup2_child(), run_exec_open(), run_exec_rlimit(), and save_redirect_fd().

#define EXIT_FAILURE 1

Definition at line 39 of file process.c.

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

#define EXIT_SUCCESS 0

Definition at line 36 of file process.c.

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

#define MAXPATHLEN 1024

Definition at line 54 of file process.c.

Referenced by proc_exec_v(), and rb_proc_exec().

#define NO_WAITPID

Definition at line 591 of file process.c.

#define NUM2RLIM | ( |  | v | ) | NUM2UINT(v)

Definition at line 127 of file process.c.

Referenced by rlimit_resource_value(), and run_exec_rlimit().

#define p_sys_issetugid rb_f_notimplement

Definition at line 4323 of file process.c.

Referenced by Init_process().

#define p_sys_setegid rb_f_notimplement

Definition at line 4248 of file process.c.

Referenced by Init_process().

#define p_sys_seteuid rb_f_notimplement

Definition at line 3895 of file process.c.

Referenced by Init_process().

#define p_sys_setgid rb_f_notimplement

Definition at line 4204 of file process.c.

Referenced by Init_process().

#define p_sys_setregid rb_f_notimplement

Definition at line 4272 of file process.c.

Referenced by Init_process().

#define p_sys_setresgid rb_f_notimplement

Definition at line 4295 of file process.c.

Referenced by Init_process().

#define p_sys_setresuid rb_f_notimplement

Definition at line 3943 of file process.c.

Referenced by Init_process().

#define p_sys_setreuid rb_f_notimplement

Definition at line 3919 of file process.c.

Referenced by Init_process().

#define p_sys_setrgid rb_f_notimplement

Definition at line 4226 of file process.c.

Referenced by Init_process().

#define p_sys_setruid rb_f_notimplement

Definition at line 3873 of file process.c.

Referenced by Init_process().

#define p_sys_setuid rb_f_notimplement

Definition at line 3851 of file process.c.

Referenced by Init_process().

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

Definition at line 136 of file process.c.

Referenced by proc_exec_v(), rb_exec(), and rb_proc_exec().

#define proc_daemon rb_f_notimplement

Definition at line 4621 of file process.c.

Referenced by Init_process().

#define proc_getgroups rb_f_notimplement

Definition at line 4420 of file process.c.

Referenced by Init_process().

#define proc_getpgid rb_f_notimplement

Definition at line 3373 of file process.c.

Referenced by Init_process().

#define proc_getpgrp rb_f_notimplement

Definition at line 3318 of file process.c.

Referenced by Init_process().

#define proc_getpriority rb_f_notimplement

Definition at line 3494 of file process.c.

Referenced by Init_process().

#define proc_getrlimit rb_f_notimplement

Definition at line 3727 of file process.c.

Referenced by Init_process().

#define proc_initgroups rb_f_notimplement

Definition at line 4512 of file process.c.

Referenced by Init_process().

#define proc_setegid_m rb_f_notimplement

Definition at line 4982 of file process.c.

Referenced by Init_process().

#define proc_seteuid_m rb_f_notimplement

Definition at line 4862 of file process.c.

Referenced by Init_process().

#define proc_setgid rb_f_notimplement

Definition at line 4381 of file process.c.

Referenced by Init_process().

#define proc_setgroups rb_f_notimplement

Definition at line 4481 of file process.c.

Referenced by Init_process().

#define proc_setpgid rb_f_notimplement

Definition at line 3399 of file process.c.

Referenced by Init_process().

#define proc_setpgrp rb_f_notimplement

Definition at line 3347 of file process.c.

Referenced by Init_process().

#define proc_setpriority rb_f_notimplement

Definition at line 3526 of file process.c.

Referenced by Init_process().

#define proc_setrlimit rb_f_notimplement

Definition at line 3798 of file process.c.

Referenced by Init_process().

#define proc_setsid rb_f_notimplement

Definition at line 3457 of file process.c.

Referenced by Init_process().

#define proc_setuid rb_f_notimplement

Definition at line 4002 of file process.c.

Referenced by Init_process().

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

Definition at line 254 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 2641 of file process.c.

Referenced by Init_process().

#define rb_proc_times rb_f_notimplement

Definition at line 5414 of file process.c.

Referenced by Init_process().

#define redirect_close | ( |  | fd | ) | close(fd)

Definition at line 1855 of file process.c.

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

#define redirect_dup | ( |  | oldfd | ) | dup(oldfd)

Definition at line 1853 of file process.c.

Referenced by run_exec_dup2(), and save_redirect_fd().

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

Definition at line 1854 of file process.c.

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

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

Definition at line 1856 of file process.c.

Referenced by run_exec_open().

#define RLIM2NUM | ( |  | v | ) | UINT2NUM(v)

Definition at line 126 of file process.c.

Referenced by Init_process(), and run_exec_rlimit().

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

Definition at line 86 of file process.c.

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

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

Definition at line 77 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 80 of file process.c.

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

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

Definition at line 83 of file process.c.

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

#define WSTOPSIG WEXITSTATUS

Definition at line 92 of file process.c.

Referenced by pst_message(), and pst_wstopsig().

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

Definition at line 89 of file process.c.

Referenced by pst_message(), and pst_wtermsig().

## Enumeration Type Documentation

anonymous enum

Enumerator:

  EXEC_OPTION_PGROUP |
  EXEC_OPTION_RLIMIT |
  EXEC_OPTION_UNSETENV_OTHERS |
  EXEC_OPTION_ENV |
  EXEC_OPTION_CHDIR |
  EXEC_OPTION_UMASK |
  EXEC_OPTION_DUP2 |
  EXEC_OPTION_CLOSE |
  EXEC_OPTION_OPEN |
  EXEC_OPTION_DUP2_CHILD |
  EXEC_OPTION_CLOSE_OTHERS |

Definition at line 1222 of file process.c.

## Function Documentation

static int check_exec_env_i | ( | st_data_t | st_key,
|  | st_data_t | st_val,
|  | st_data_t | arg
| ) |  | `[static]`

Definition at line 1593 of file process.c.

References env, hide_obj(), NIL_P, rb_ary_push(), rb_assoc_new(), rb_eArgError, rb_raise(), ST_CONTINUE, strchr(), and StringValueCStr.

Referenced by rb_check_exec_env().

static VALUE check_exec_fds | ( | VALUE | options | ) | `[static]`

Definition at line 1514 of file process.c.

References EXEC_OPTION_CLOSE_OTHERS, EXEC_OPTION_DUP2, EXEC_OPTION_DUP2_CHILD, EXEC_OPTION_OPEN, FIX2INT, FIXNUM_P, INT2FIX, NIL_P, Qfalse, Qtrue, RARRAY_LEN, RARRAY_PTR, rb_ary_entry(), rb_ary_store(), rb_eArgError, rb_hash_aset(), rb_hash_lookup, rb_hash_new(), rb_raise(), and RTEST.

Referenced by rb_exec_arg_fixup().

static int check_exec_options_i | ( | st_data_t | st_key,
|  | st_data_t | st_val,
|  | st_data_t | arg
| ) |  | `[static]`

Definition at line 1505 of file process.c.

References rb_exec_arg_addopt().

Referenced by rb_check_exec_options().

static void check_exec_redirect | ( | VALUE | key,
|  | VALUE | val,
|  | VALUE | options
| ) |  | `[static]`

Definition at line 1273 of file process.c.

References check_exec_redirect_fd(), EXEC_OPTION_CLOSE, EXEC_OPTION_DUP2, EXEC_OPTION_DUP2_CHILD, EXEC_OPTION_OPEN, FilePathValue, FIX2INT, FIXNUM_P, hide_obj(), id, INT2FIX, INT2NUM(), NIL_P, Qnil, RARRAY_LEN, RARRAY_PTR, rb_ary_entry(), rb_ary_new(), rb_ary_new3(), rb_ary_push(), rb_ary_store(), rb_assoc_new(), rb_eArgError, rb_id2name(), rb_intern, rb_io_modestr_oflags(), rb_raise(), rb_str_dup(), rb_to_int(), StringValueCStr, SYM2ID, SYMBOL_P, T_ARRAY, T_FILE, T_FIXNUM, T_STRING, T_SYMBOL, and TYPE.

Referenced by rb_exec_arg_addopt().

static VALUE check_exec_redirect_fd | ( | VALUE | v | ) | `[static]`

Definition at line 1237 of file process.c.

References rb_io_t::fd, FIX2INT, FIXNUM_P, GetOpenFile, INT2FIX, NIL_P, rb_check_convert_type(), rb_eArgError, rb_intern, rb_raise(), SYM2ID, SYMBOL_P, T_FILE, and rb_io_t::tied_io_for_writing.

Referenced by check_exec_redirect().

static void check_gid_switch | ( | void |  | ) | `[static]`

Definition at line 3813 of file process.c.

References rb_eRuntimeError, rb_raise(), and rb_secure().

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

static void check_uid_switch | ( | void |  | ) | `[static]`

Definition at line 3803 of file process.c.

References rb_eRuntimeError, rb_raise(), and rb_secure().

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

static VALUE detach_process_pid | ( | VALUE | thread | ) | `[static]`

Definition at line 896 of file process.c.

References id_pid(), and rb_thread_local_aref().

Referenced by rb_detach_process().

static VALUE detach_process_watcher | ( | void * | arg | ) | `[static]`

Definition at line 902 of file process.c.

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

Referenced by rb_detach_process().

static VALUE get_pid | ( | void |  | ) | `[static]`

Definition at line 151 of file process.c.

References PIDT2NUM, and rb_secure().

Referenced by Init_process().

static VALUE get_ppid | ( | void |  | ) | `[static]`

Definition at line 175 of file process.c.

References PIDT2NUM, and rb_secure().

Referenced by Init_process().

static VALUE hide_obj | ( | VALUE | obj | ) | `[static]`

Definition at line 1216 of file process.c.

References RBASIC.

Referenced by check_exec_env_i(), check_exec_redirect(), rb_check_exec_env(), rb_exec_arg_addopt(), rb_exec_fillarg(), rb_run_exec_options_err(), run_exec_rlimit(), save_env(), save_env_i(), and save_redirect_fd().

static ID id_pid | ( | void |  | ) | `[inline, static]`

Definition at line 888 of file process.c.

References CONST_ID, and wait_data::pid.

Referenced by detach_process_pid(), and rb_detach_process().

void Init_process | ( | void |  | ) |

Definition at line 5429 of file process.c.

References CLASS_OF, get_pid(), get_ppid(), getegid(), geteuid(), inf(), INT2FIX, NULL, p_gid_change_privilege(), p_gid_exchange(), p_gid_exchangeable(), 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_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_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_cObject, rb_cProcessStatus, 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(), rb_undef_method(), RLIM2NUM, and WNOHANG.

static int intcmp | ( | const void * | a,
|  | const void * | b
| ) |  | `[static]`

Definition at line 1913 of file process.c.

Referenced by run_exec_dup2().

static int intrcmp | ( | const void * | a,
|  | const void * | b
| ) |  | `[static]`

Definition at line 1919 of file process.c.

Referenced by run_exec_dup2().

static VALUE p_gid_change_privilege | ( | VALUE | obj,
|  | VALUE | id
| ) |  | `[static]`

Definition at line 4665 of file process.c.

References check_gid_switch(), EPERM, errno, getegid(), geteuid(), getgid(), id, NUM2GIDT, rb_notimplement(), rb_sys_fail(), and setgid().

Referenced by Init_process().

static VALUE p_gid_exchange | ( | VALUE | obj | ) | `[static]`

Definition at line 5134 of file process.c.

References check_gid_switch(), getegid(), getgid(), GIDT2NUM, rb_notimplement(), and rb_sys_fail().

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

static VALUE p_gid_exchangeable | ( | void |  | ) | `[static]`

Definition at line 5109 of file process.c.

References Qfalse, and Qtrue.

Referenced by Init_process().

static VALUE p_gid_grant_privilege | ( | VALUE | obj,
|  | VALUE | id
| ) |  | `[static]`

Definition at line 5035 of file process.c.

References id, NUM2GIDT, and rb_setegid_core().

Referenced by Init_process().

static VALUE p_gid_have_saved_id | ( | void |  | ) | `[static]`

Definition at line 5276 of file process.c.

References Qfalse, and Qtrue.

Referenced by Init_process().

static VALUE p_gid_sw_ensure | ( | VALUE | obj | ) | `[static]`

Definition at line 5343 of file process.c.

References p_gid_exchange().

Referenced by p_gid_switch().

static VALUE p_gid_switch | ( | VALUE | obj | ) | `[static]`

Definition at line 5350 of file process.c.

References check_gid_switch(), EPERM, errno, getegid(), getgid(), GIDT2NUM, p_gid_exchange(), p_gid_sw_ensure(), Qnil, rb_block_given_p(), rb_ensure(), rb_sys_fail(), and rb_yield().

Referenced by Init_process().

static VALUE p_uid_change_privilege | ( | VALUE | obj,
|  | VALUE | id
| ) |  | `[static]`

Definition at line 4047 of file process.c.

References check_uid_switch(), EPERM, errno, geteuid(), getuid(), id, NUM2UIDT, rb_notimplement(), rb_sys_fail(), and setuid().

Referenced by Init_process().

static VALUE p_uid_exchange | ( | VALUE | obj | ) | `[static]`

Definition at line 5077 of file process.c.

References check_uid_switch(), geteuid(), getuid(), rb_notimplement(), rb_sys_fail(), and UIDT2NUM.

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

static VALUE p_uid_exchangeable | ( | void |  | ) | `[static]`

Definition at line 5052 of file process.c.

References Qfalse, and Qtrue.

Referenced by Init_process().

static VALUE p_uid_grant_privilege | ( | VALUE | obj,
|  | VALUE | id
| ) |  | `[static]`

Definition at line 4915 of file process.c.

References id, NUM2UIDT, and rb_seteuid_core().

Referenced by Init_process().

static VALUE p_uid_have_saved_id | ( | void |  | ) | `[static]`

Definition at line 5167 of file process.c.

References Qfalse, and Qtrue.

Referenced by Init_process().

static VALUE p_uid_sw_ensure | ( | VALUE | obj | ) | `[static]`

Definition at line 5233 of file process.c.

References p_uid_exchange().

Referenced by p_uid_switch().

static VALUE p_uid_switch | ( | VALUE | obj | ) | `[static]`

Definition at line 5240 of file process.c.

References check_uid_switch(), EPERM, errno, geteuid(), getuid(), p_uid_exchange(), p_uid_sw_ensure(), Qnil, rb_block_given_p(), rb_ensure(), rb_sys_fail(), rb_yield(), and UIDT2NUM.

Referenced by Init_process().

static VALUE proc_detach | ( | VALUE | obj,
|  | VALUE | pid
| ) |  | `[static]`

Definition at line 971 of file process.c.

References NUM2PIDT, rb_detach_process(), and rb_secure().

Referenced by Init_process().

static int proc_exec_v | ( | char ** | argv,
|  | const char * | prog
| ) |  | `[static]`

Definition at line 1007 of file process.c.

References after_exec, ALLOCA_N, before_exec, dln_find_exe_r(), errno, execv(), fbuf, MAXPATHLEN, NULL, preserving_errno, STRCASECMP, and strrchr().

Referenced by rb_proc_exec(), and rb_proc_exec_n().

static VALUE proc_getegid | ( | VALUE | obj | ) | `[static]`

Definition at line 4935 of file process.c.

References getegid(), and GIDT2NUM.

Referenced by Init_process().

static VALUE proc_geteuid | ( | VALUE | obj | ) | `[static]`

Definition at line 4816 of file process.c.

References geteuid(), and UIDT2NUM.

Referenced by Init_process().

static VALUE proc_getgid | ( | VALUE | obj | ) | `[static]`

Definition at line 4339 of file process.c.

References getgid(), and GIDT2NUM.

Referenced by Init_process().

static VALUE proc_getmaxgroups | ( | VALUE | obj | ) | `[static]`

Definition at line 4527 of file process.c.

References INT2FIX.

Referenced by Init_process().

static VALUE proc_getuid | ( | VALUE | obj | ) | `[static]`

Definition at line 3959 of file process.c.

References getuid(), and UIDT2NUM.

Referenced by Init_process().

static VALUE proc_setmaxgroups | ( | VALUE | obj,
|  | VALUE | val
| ) |  | `[static]`

Definition at line 4542 of file process.c.

References FIX2UINT, and INT2FIX.

Referenced by Init_process().

static VALUE proc_wait | ( | int | argc,
|  | VALUE * | argv
| ) |  | `[static]`

Definition at line 771 of file process.c.

References NIL_P, NUM2PIDT, NUM2UINT, wait_data::pid, PIDT2NUM, Qnil, rb_last_status_clear(), rb_scan_args(), rb_secure(), rb_sys_fail(), rb_waitpid(), and wait_data::status.

Referenced by Init_process(), and proc_wait2().

static VALUE proc_wait2 | ( | int | argc,
|  | VALUE * | argv
| ) |  | `[static]`

Definition at line 817 of file process.c.

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

Referenced by Init_process().

static VALUE proc_waitall | ( | void |  | ) | `[static]`

Definition at line 846 of file process.c.

References errno, wait_data::pid, PIDT2NUM, rb_ary_new(), rb_ary_push(), rb_assoc_new(), rb_last_status_clear(), rb_last_status_get(), rb_last_status_set(), rb_secure(), rb_sys_fail(), rb_thread_schedule(), rb_waitpid(), result, st_foreach, wait_data::status, wait(), and waitall_each().

Referenced by Init_process().

static VALUE pst_bitand | ( | VALUE | st1,
|  | VALUE | st2
| ) |  | `[static]`

Definition at line 388 of file process.c.

References INT2NUM(), NUM2INT, and PST2INT.

Referenced by Init_process().

static VALUE pst_equal | ( | VALUE | st1,
|  | VALUE | st2
| ) |  | `[static]`

Definition at line 368 of file process.c.

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

Referenced by Init_process().

static VALUE pst_inspect | ( | VALUE | st | ) | `[static]`

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

static void pst_message | ( | VALUE | str,
|  | rb_pid_t | pid,
|  | int | status
| ) |  | `[static]`

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

static VALUE pst_pid | ( | VALUE | st | ) | `[static]`

Definition at line 268 of file process.c.

References rb_attr_get(), and rb_intern.

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

static VALUE pst_rshift | ( | VALUE | st1,
|  | VALUE | st2
| ) |  | `[static]`

Definition at line 409 of file process.c.

References INT2NUM(), NUM2INT, and PST2INT.

Referenced by Init_process().

static VALUE pst_success_p | ( | VALUE | st | ) | `[static]`

Definition at line 557 of file process.c.

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

Referenced by Init_process().

static VALUE pst_to_i | ( | VALUE | st | ) | `[static]`

Definition at line 249 of file process.c.

References rb_iv_get().

Referenced by Init_process(), and pst_equal().

static VALUE pst_to_s | ( | VALUE | st | ) | `[static]`

Definition at line 316 of file process.c.

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

Referenced by Init_process().

static VALUE pst_wcoredump | ( | VALUE | st | ) | `[static]`

Definition at line 576 of file process.c.

References PST2INT, Qfalse, and Qtrue.

Referenced by Init_process().

static VALUE pst_wexitstatus | ( | VALUE | st | ) | `[static]`

Definition at line 538 of file process.c.

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

Referenced by Init_process().

static VALUE pst_wifexited | ( | VALUE | st | ) | `[static]`

Definition at line 507 of file process.c.

References PST2INT, Qfalse, Qtrue, and WIFEXITED.

Referenced by Init_process().

static VALUE pst_wifsignaled | ( | VALUE | st | ) | `[static]`

Definition at line 466 of file process.c.

References PST2INT, Qfalse, Qtrue, and WIFSIGNALED.

Referenced by Init_process().

static VALUE pst_wifstopped | ( | VALUE | st | ) | `[static]`

Definition at line 427 of file process.c.

References PST2INT, Qfalse, Qtrue, and WIFSTOPPED.

Referenced by Init_process().

static VALUE pst_wstopsig | ( | VALUE | st | ) | `[static]`

Definition at line 447 of file process.c.

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

Referenced by Init_process().

static VALUE pst_wtermsig | ( | VALUE | st | ) | `[static]`

Definition at line 487 of file process.c.

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

Referenced by Init_process().

static VALUE rb_check_argv | ( | int | argc,
|  | VALUE * | argv
| ) |  | `[static]`

Definition at line 1624 of file process.c.

References argc, name, NIL_P, rb_exec_arg::prog, RARRAY_LEN, RARRAY_PTR, rb_check_array_type(), rb_eArgError, rb_raise(), rb_str_new4(), RSTRING_PTR, SafeStringValue, security(), and StringValueCStr.

Referenced by rb_exec_getargs().

static VALUE rb_check_exec_env | ( | VALUE | hash | ) | `[static]`

Definition at line 1613 of file process.c.

References check_exec_env_i(), env, hide_obj(), rb_ary_new(), RHASH_TBL, and st_foreach.

Referenced by rb_exec_fillarg().

static void rb_check_exec_options | ( | VALUE | opthash,
|  | struct rb_exec_arg * | e
| ) |  | `[static]`

Definition at line 1585 of file process.c.

References check_exec_options_i(), RHASH_EMPTY_P, RHASH_TBL, and st_foreach.

Referenced by rb_exec_fillarg().

VALUE rb_detach_process | ( | rb_pid_t | pid | ) |

Definition at line 914 of file process.c.

References detach_process_pid(), detach_process_watcher(), id_pid(), PIDT2NUM, rb_define_singleton_method(), rb_thread_create(), and rb_thread_local_aset().

Referenced by proc_detach(), and pty_detach_process().

int rb_exec | ( | const struct rb_exec_arg * | e | ) |

Definition at line 2349 of file process.c.

References NULL, preserving_errno, rb_exec_arg::prog, rb_exec_err(), rb_sourcefile(), and rb_sourceline().

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

Definition at line 1381 of file process.c.

References check_exec_redirect(), EXEC_OPTION_CHDIR, EXEC_OPTION_CLOSE_OTHERS, EXEC_OPTION_PGROUP, EXEC_OPTION_RLIMIT, EXEC_OPTION_UMASK, EXEC_OPTION_UNSETENV_OTHERS, FilePathValue, hide_obj(), id, INT2FIX, INT2NUM(), LONG2NUM, mode_t, NIL_P, NUM2LONG(), NUM2PIDT, rb_exec_arg::options, options(), PIDT2NUM, Qfalse, Qtrue, RARRAY_LEN, rb_ary_entry(), rb_ary_new(), rb_ary_new3(), rb_ary_push(), rb_ary_store(), rb_check_array_type(), rb_eArgError, rb_id2name(), rb_intern, rb_raise(), rb_secure(), rb_str_dup(), rb_to_int(), rlimit_type_by_lname(), RTEST, ST_CONTINUE, SYM2ID, T_ARRAY, T_FILE, T_FIXNUM, T_SYMBOL, and TYPE.

Referenced by check_exec_options_i(), pipe_open(), rb_exec_arg_prepare(), and rb_f_exec().

void rb_exec_arg_fixup | ( | struct rb_exec_arg * | e | ) |

Definition at line 1720 of file process.c.

References check_exec_fds(), rb_exec_arg::options, and rb_exec_arg::redirect_fds.

Referenced by pipe_open(), rb_exec_arg_prepare(), and rb_f_exec().

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

Definition at line 1710 of file process.c.

References env, rb_exec_arg::prog, Qnil, rb_exec_fillarg(), and rb_exec_getargs().

Referenced by pipe_open_s(), pipe_open_v(), rb_exec_arg_prepare(), and rb_f_exec().

static VALUE rb_exec_arg_prepare | ( | struct rb_exec_arg * | earg,
|  | int | argc,
|  | VALUE * | argv,
|  | int | default_close_others
| ) |  | `[static]`

Definition at line 2854 of file process.c.

References EXEC_OPTION_CLOSE_OTHERS, ID2SYM, NIL_P, rb_exec_arg::options, Qfalse, Qtrue, rb_ary_entry(), rb_exec_arg_addopt(), rb_exec_arg_fixup(), rb_exec_arg_init(), rb_intern, and TRUE.

Referenced by rb_f_spawn(), and rb_spawn_internal().

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

Definition at line 2329 of file process.c.

References rb_exec_arg::argc, rb_exec_arg::argv, NULL, rb_exec_arg::prog, rb_proc_exec(), rb_proc_exec_n(), and rb_run_exec_options_err().

Referenced by rb_exec(), and rb_f_exec().

static void rb_exec_fillarg | ( | VALUE | prog,
|  | int | argc,
|  | VALUE * | argv,
|  | VALUE | env,
|  | VALUE | opthash,
|  | struct rb_exec_arg * | e
| ) |  | `[static]`

Definition at line 1689 of file process.c.

References argc, rb_exec_arg::argc, argv, rb_exec_arg::argv, EXEC_OPTION_ENV, hide_obj(), MEMZERO, NIL_P, rb_exec_arg::options, options(), rb_exec_arg::prog, rb_ary_new(), rb_ary_store(), rb_check_exec_env(), rb_check_exec_options(), and RSTRING_PTR.

Referenced by rb_exec_arg_init().

static VALUE rb_exec_getargs | ( | int * | argc_p,
|  | VALUE ** | argv_p,
|  | int | accept_shell,
|  | VALUE * | env_ret,
|  | VALUE * | opthash_ret,
|  | struct rb_exec_arg * | e
| ) |  | `[static]`

Definition at line 1657 of file process.c.

References hash(), NIL_P, rb_exec_arg::prog, rb_check_argv(), rb_check_convert_type(), and T_HASH.

Referenced by rb_exec_arg_init().

void rb_exit | ( | int | status | ) |

Definition at line 2684 of file process.c.

References GET_THREAD, INT2NUM(), rb_class_new_instance(), rb_eSystemExit, rb_exc_raise(), rb_str_new2(), and ruby_finalize().

Referenced by rb_f_abort(), rb_f_exit(), and rb_thread_kill().

VALUE rb_f_abort | ( | int | argc,
|  | VALUE * | argv
| ) |  |

Definition at line 2783 of file process.c.

References EXIT_FAILURE, GET_THREAD, INT2NUM(), NIL_P, Qnil, rb_class_new_instance(), rb_eSystemExit, rb_exc_raise(), rb_exit(), rb_io_puts(), rb_scan_args(), rb_secure(), rb_stderr, ruby_error_print(), and StringValue.

Referenced by Init_process().

VALUE rb_f_exec | ( | int | argc,
|  | VALUE * | argv
| ) |  |

Definition at line 1770 of file process.c.

References CHILD_ERRMSG_BUFLEN, EXEC_OPTION_CLOSE_OTHERS, ID2SYM, NIL_P, rb_exec_arg::options, rb_exec_arg::prog, Qfalse, Qnil, rb_ary_entry(), rb_exec_arg_addopt(), rb_exec_arg_fixup(), rb_exec_arg_init(), rb_exec_err(), rb_intern, rb_sys_fail(), and TRUE.

Referenced by Init_process(), and pty_exec().

VALUE rb_f_exit | ( | int | argc,
|  | VALUE * | argv
| ) |  |

Definition at line 2740 of file process.c.

References EXIT_FAILURE, EXIT_SUCCESS, NUM2INT, Qfalse, Qnil, Qtrue, rb_exit(), rb_scan_args(), and rb_secure().

Referenced by Init_process().

static VALUE rb_f_exit_bang | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | obj
| ) |  | `[static]`

Definition at line 2656 of file process.c.

References EXIT_FAILURE, EXIT_SUCCESS, NUM2INT, Qfalse, Qnil, Qtrue, rb_scan_args(), and rb_secure().

Referenced by Init_process().

static VALUE rb_f_sleep | ( | int | argc,
|  | VALUE * | argv
| ) |  | `[static]`

Definition at line 3268 of file process.c.

References INT2FIX, rb_eArgError, rb_raise(), rb_thread_sleep_forever(), rb_thread_wait_for(), rb_time_interval(), and time_t.

Referenced by Init_process().

static VALUE rb_f_spawn | ( | int | argc,
|  | VALUE * | argv
| ) |  | `[static]`

Definition at line 3229 of file process.c.

References rb_exec_arg::argc, rb_exec_arg::argv, CHILD_ERRMSG_BUFLEN, PIDT2NUM, rb_exec_arg::prog, Qnil, rb_exec_arg_prepare(), rb_spawn_process(), rb_sys_fail(), RSTRING_PTR, and TRUE.

Referenced by Init_process().

static VALUE rb_f_system | ( | int | argc,
|  | VALUE * | argv
| ) |  | `[static]`

Definition at line 2965 of file process.c.

References chfunc(), EXIT_SUCCESS, FALSE, NULL, PST2INT, Qfalse, Qnil, Qtrue, rb_last_status_get(), rb_spawn_internal(), rb_syswait(), and signal().

Referenced by Init_process().

static void rb_last_status_clear | ( | void |  | ) | `[static]`

Definition at line 230 of file process.c.

References GET_THREAD, and Qnil.

Referenced by proc_wait(), and proc_waitall().

VALUE rb_last_status_get | ( | void |  | ) |

Definition at line 215 of file process.c.

References GET_THREAD.

Referenced by detach_process_watcher(), Init_process(), proc_wait2(), proc_waitall(), pty_check(), raise_from_check(), rb_f_system(), and waitall_each().

void rb_last_status_set | ( | int | status,
|  | rb_pid_t | pid
| ) |  |

Definition at line 221 of file process.c.

References GET_THREAD, INT2FIX, rb_thread_struct::last_status, PIDT2NUM, rb_cProcessStatus, rb_iv_set(), and rb_obj_alloc().

Referenced by pipe_finalize(), proc_waitall(), rb_spawn_process(), rb_waitpid(), and waitall_each().

int rb_proc_exec | ( | const char * | str | ) |

Definition at line 1072 of file process.c.

References after_exec, ALLOCA_N, argv, before_exec, dln_find_exe_r(), errno, execl(), fbuf, ISALPHA, ISSPACE, MAXPATHLEN, NULL, preserving_errno, proc_exec_v(), rb_w32_spawn(), wait_data::status, strchr(), and strtok().

Referenced by rb_exec_err().

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

Definition at line 1055 of file process.c.

References ALLOCA_N, argc, proc_exec_v(), and RSTRING_PTR.

Referenced by rb_exec_err().

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

Definition at line 2323 of file process.c.

References NULL, and rb_run_exec_options_err().

Referenced by pipe_open().

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 2208 of file process.c.

References rb_exec_arg::argc, rb_exec_arg::argv, ERRMSG, EXEC_OPTION_CHDIR, EXEC_OPTION_CLOSE, EXEC_OPTION_CLOSE_OTHERS, EXEC_OPTION_DUP2, EXEC_OPTION_DUP2_CHILD, EXEC_OPTION_ENV, EXEC_OPTION_OPEN, EXEC_OPTION_PGROUP, EXEC_OPTION_RLIMIT, EXEC_OPTION_UMASK, EXEC_OPTION_UNSETENV_OTHERS, FIX2INT, hide_obj(), LONG2NUM, mode_t, my_getcwd, NIL_P, NULL, NUM2LONG(), rb_exec_arg::options, options(), rb_exec_arg::prog, Qfalse, Qnil, RARRAY_LEN, RARRAY_PTR, rb_ary_entry(), rb_ary_new(), rb_ary_store(), rb_close_before_exec(), rb_env_clear(), rb_str_new2(), rb_warn(), rb_exec_arg::redirect_fds, RSTRING_PTR, RTEST, ruby_setenv(), run_exec_close(), run_exec_dup2(), run_exec_dup2_child(), run_exec_open(), run_exec_rlimit(), save_env(), StringValueCStr, and xfree().

Referenced by rb_exec_err(), rb_run_exec_options(), and rb_spawn_process().

static rb_gid_t rb_setegid_core | ( | rb_gid_t | egid | ) | `[static]`

Definition at line 4986 of file process.c.

References check_gid_switch(), geteuid(), getgid(), rb_notimplement(), rb_sys_fail(), and setgid().

Referenced by p_gid_grant_privilege().

static rb_uid_t rb_seteuid_core | ( | rb_uid_t | euid | ) | `[static]`

Definition at line 4866 of file process.c.

References check_uid_switch(), geteuid(), getuid(), rb_notimplement(), rb_sys_fail(), and setuid().

Referenced by p_uid_grant_privilege().

rb_pid_t rb_spawn | ( | int | argc,
|  | VALUE * | argv
| ) |  |

Definition at line 2926 of file process.c.

References NULL, rb_spawn_internal(), and TRUE.

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

Definition at line 2920 of file process.c.

References rb_spawn_internal(), and TRUE.

static rb_pid_t rb_spawn_internal | ( | int | argc,
|  | VALUE * | argv,
|  | int | default_close_others,
|  | char * | errmsg,
|  | size_t | errmsg_buflen
| ) |  | `[static]`

Definition at line 2911 of file process.c.

References rb_exec_arg_prepare(), and rb_spawn_process().

Referenced by rb_f_system(), rb_spawn(), and rb_spawn_err().

static rb_pid_t rb_spawn_process | ( | struct rb_exec_arg * | earg,
|  | VALUE | prog,
|  | char * | errmsg,
|  | size_t | errmsg_buflen
| ) |  | `[static]`

Definition at line 2866 of file process.c.

References rb_exec_arg::argc, argc, rb_exec_arg::argv, argv, NULL, rb_exec_arg::prog, rb_ary_join(), rb_ary_new4(), rb_fork_err(), rb_last_status_set(), rb_run_exec_options_err(), rb_str_new2(), rb_exec_arg::redirect_fds, RSTRING_PTR, and StringValuePtr.

Referenced by rb_f_spawn(), and rb_spawn_internal().

void rb_syswait | ( | rb_pid_t | pid | ) |

Definition at line 2812 of file process.c.

References errno, FALSE, rb_waitpid(), SIGINT, signal(), and TRUE.

Referenced by rb_f_system(), and rb_io_close().

void rb_thread_reset_timer_thread | ( | void |  | ) |

Definition at line 2709 of file thread.c.

void rb_thread_start_timer_thread | ( | void |  | ) |

Definition at line 2715 of file thread.c.

void rb_thread_stop_timer_thread | ( | void |  | ) |

Definition at line 2701 of file thread.c.

struct timeval rb_time_interval | ( | VALUE |  | ) | `[read]`

Definition at line 2371 of file time.c.

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

Definition at line 644 of file process.c.

References errno, wait_data::pid, rb_eArgError, rb_last_status_set(), rb_raise(), rb_thread_alone(), rb_thread_blocking_region(), rb_thread_schedule(), rb_waitpid_blocking(), result, RUBY_UBF_PROCESS, RUBY_VM_CHECK_INTS, st_delete, st_foreach, st_init_numtable, st_insert, wait_data::status, and wait_each().

Referenced by detach_process_watcher(), proc_wait(), proc_waitall(), pty_check(), and rb_syswait().

static VALUE rb_waitpid_blocking | ( | void * | data | ) | `[static]`

Definition at line 625 of file process.c.

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

Referenced by rb_waitpid().

static int rlimit_resource_name2int | ( | const char * | name,
|  | int | casetype
| ) |  | `[static]`

Definition at line 3531 of file process.c.

References ALLOCA_N, ISLOWER, len, and TOUPPER.

Referenced by rlimit_type_by_hname(), and rlimit_type_by_lname().

static int rlimit_resource_type | ( | VALUE | rtype | ) | `[static]`

Definition at line 3621 of file process.c.

References name, NIL_P, NUM2INT, rb_check_string_type(), rb_eArgError, rb_id2name(), rb_raise(), rlimit_type_by_hname(), StringValueCStr, SYM2ID, T_BIGNUM, T_FIXNUM, T_STRING, T_SYMBOL, and TYPE.

static rlim_t rlimit_resource_value | ( | VALUE | rval | ) | `[static]`

Definition at line 3655 of file process.c.

References name, NIL_P, NUM2RLIM, rb_check_string_type(), rb_eArgError, rb_id2name(), rb_raise(), StringValueCStr, SYM2ID, T_BIGNUM, T_FIXNUM, T_STRING, T_SYMBOL, and TYPE.

static int rlimit_type_by_hname | ( | const char * | name | ) | `[static]`

Definition at line 3609 of file process.c.

References rlimit_resource_name2int().

Referenced by rlimit_resource_type().

static int rlimit_type_by_lname | ( | const char * | name | ) | `[static]`

Definition at line 3615 of file process.c.

References rlimit_resource_name2int().

Referenced by rb_exec_arg_addopt().

static int run_exec_close | ( | VALUE | ary,
|  | char * | errmsg,
|  | size_t | errmsg_buflen
| ) |  | `[static]`

Definition at line 2063 of file process.c.

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

Referenced by rb_run_exec_options_err().

static int run_exec_dup2 | ( | VALUE | ary,
|  | VALUE | save,
|  | char * | errmsg,
|  | size_t | errmsg_buflen
| ) |  | `[static]`

Definition at line 1925 of file process.c.

References ERRMSG, fcntl(), FIX2INT, intcmp(), intrcmp(), malloc, NULL, RARRAY_LEN, RARRAY_PTR, redirect_close, redirect_dup, redirect_dup2, RTEST, save_redirect_fd(), and xfree().

Referenced by rb_run_exec_options_err().

static int run_exec_dup2_child | ( | VALUE | ary,
|  | VALUE | save,
|  | char * | errmsg,
|  | size_t | errmsg_buflen
| ) |  | `[static]`

Definition at line 2126 of file process.c.

References ERRMSG, FIX2INT, RARRAY_LEN, RARRAY_PTR, redirect_dup2, and save_redirect_fd().

Referenced by rb_run_exec_options_err().

static int run_exec_open | ( | VALUE | ary,
|  | VALUE | save,
|  | char * | errmsg,
|  | size_t | errmsg_buflen
| ) |  | `[static]`

Definition at line 2080 of file process.c.

References ERRMSG, FIX2INT, NUM2INT, RARRAY_LEN, RARRAY_PTR, redirect_close, redirect_dup2, redirect_open, RSTRING_PTR, and save_redirect_fd().

Referenced by rb_run_exec_options_err().

static int run_exec_rlimit | ( | VALUE | ary,
|  | VALUE | save,
|  | char * | errmsg,
|  | size_t | errmsg_buflen
| ) |  | `[static]`

Definition at line 2173 of file process.c.

References ERRMSG, EXEC_OPTION_RLIMIT, getrlimit(), hide_obj(), NIL_P, NUM2INT, NUM2RLIM, RARRAY_LEN, RARRAY_PTR, rb_ary_entry(), rb_ary_new(), rb_ary_new3(), rb_ary_push(), rb_ary_store(), RLIM2NUM, and setrlimit().

Referenced by rb_run_exec_options_err().

static void save_env | ( | VALUE | save | ) | `[static]`

Definition at line 1898 of file process.c.

References env, EXEC_OPTION_ENV, EXEC_OPTION_UNSETENV_OTHERS, hide_obj(), NIL_P, Qtrue, rb_ary_entry(), rb_ary_new(), rb_ary_store(), rb_block_call, rb_cObject, rb_const_get(), rb_intern, RTEST, and save_env_i().

Referenced by rb_run_exec_options_err().

static VALUE save_env_i | ( | VALUE | i,
|  | VALUE | ary,
|  | int | argc,
|  | VALUE * | argv
| ) |  | `[static]`

Definition at line 1891 of file process.c.

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

Referenced by save_env().

static int save_redirect_fd | ( | int | fd,
|  | VALUE | save,
|  | char * | errmsg,
|  | size_t | errmsg_buflen
| ) |  | `[static]`

Definition at line 1860 of file process.c.

References ERRMSG, errno, EXEC_OPTION_CLOSE, EXEC_OPTION_DUP2, hide_obj(), INT2FIX, NIL_P, Qnil, rb_ary_entry(), rb_ary_new(), rb_ary_push(), rb_ary_store(), rb_assoc_new(), and redirect_dup.

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

static void security | ( | const char * | str | ) | `[static]`

Definition at line 997 of file process.c.

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

Referenced by rb_check_argv().

char* strtok | ( |  | ) |

Referenced by rb_proc_exec().

static int wait_each | ( | rb_pid_t | pid,
|  | int | status,
|  | struct wait_data * | data
| ) |  | `[static]`

Definition at line 600 of file process.c.

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

Referenced by rb_waitpid().

static int waitall_each | ( | rb_pid_t | pid,
|  | int | status,
|  | VALUE | ary
| ) |  | `[static]`

Definition at line 610 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

int forked_child = 0`[static]`

Definition at line 985 of file process.c.

int maxgroups = 32`[static]`

Definition at line 4385 of file process.c.

st_table* pid_tbl`[static]`

Definition at line 592 of file process.c.

VALUE rb_cProcessStatus`[static]`

Definition at line 212 of file process.c.

Referenced by Init_process(), and rb_last_status_set().

VALUE rb_mProcess

Definition at line 5417 of file process.c.

VALUE rb_mProcGID

Definition at line 5419 of file process.c.

VALUE rb_mProcID_Syscall

Definition at line 5420 of file process.c.

VALUE rb_mProcUID

Definition at line 5418 of file process.c.

rb_gid_t SAVED_GROUP_ID = -1`[static]`

Definition at line 4634 of file process.c.

rb_uid_t SAVED_USER_ID = -1`[static]`

Definition at line 4016 of file process.c.

int under_gid_switch = 0`[static]`

Definition at line 3811 of file process.c.

int under_uid_switch = 0`[static]`

Definition at line 3801 of file process.c.