From 1f4513af45cfb1620bc44c60be859bd4a9c65c3c Mon Sep 17 00:00:00 2001 From: ocean Date: Wed, 21 Apr 2004 01:28:19 +0000 Subject: * process.c(rb_spawn): fix SEGV at "p system('command line here')" (may happen only in bccwin32) [ruby-dev:23380] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- process.c | 314 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 157 insertions(+), 157 deletions(-) (limited to 'process.c') diff --git a/process.c b/process.c index 705583f651..c212267ae8 100644 --- a/process.c +++ b/process.c @@ -115,10 +115,10 @@ static VALUE S_Tms; /* * call-seq: * Process.pid => fixnum - * + * * Returns the process id of this process. Not available on all * platforms. - * + * * Process.pid #=> 27415 */ @@ -132,15 +132,15 @@ get_pid() /* * call-seq: * Process.ppid => fixnum - * + * * Returns the process id of the parent of this process. Always * returns 0 on NT. Not available on all platforms. - * + * * puts "I am #{Process.pid}" * Process.fork { puts "Dad is #{Process.ppid}" } - * + * * produces: - * + * * I am 27417 * Dad is 27417 */ @@ -164,7 +164,7 @@ get_ppid() * status of a running or terminated system process. The built-in * variable $? is either +nil+ or a * Process::Status object. - * + * * fork { exit 99 } #=> 26557 * Process.wait #=> 26557 * $?.class #=> Process::Status @@ -173,7 +173,7 @@ get_ppid() * $?.stopped? #=> false * $?.exited? #=> true * $?.exitstatus #=> 99 - * + * * Posix systems record information on processes using a 16-bit * integer. The lower bits record the process status (stopped, * exited, signaled) and the upper bits possibly contain additional @@ -203,10 +203,10 @@ last_status_set(status, pid) * call-seq: * stat.to_i => fixnum * stat.to_int => fixnum - * + * * Returns the bits in _stat_ as a Fixnum. Poking * around in these bits is platform dependent. - * + * * fork { exit 0xab } #=> 26566 * Process.wait #=> 26566 * sprintf('%04x', $?.to_i) #=> "ab00" @@ -223,7 +223,7 @@ pst_to_i(st) /* * call-seq: * stat.to_s => string - * + * * Equivalent to _stat_.to_i.to_s. */ @@ -238,9 +238,9 @@ pst_to_s(st) /* * call-seq: * stat.pid => fixnum - * + * * Returns the process ID that this status object represents. - * + * * fork { exit } #=> 26569 * Process.wait #=> 26569 * $?.pid #=> 26569 @@ -257,7 +257,7 @@ pst_pid(st) /* * call-seq: * stat.inspect => string - * + * * Override the inspection method. */ @@ -314,7 +314,7 @@ pst_inspect(st) /* * call-seq: * stat == other => true or false - * + * * Returns +true+ if the integer value of _stat_ * equals other. */ @@ -331,9 +331,9 @@ pst_equal(st1, st2) /* * call-seq: * stat & num => fixnum - * + * * Logical AND of the bits in _stat_ with num. - * + * * fork { exit 0x37 } * Process.wait * sprintf('%04x', $?.to_i) #=> "3700" @@ -353,9 +353,9 @@ pst_bitand(st1, st2) /* * call-seq: * stat >> num => fixnum - * + * * Shift the bits in _stat_ right num places. - * + * * fork { exit 99 } #=> 26563 * Process.wait #=> 26563 * $?.to_i #=> 25344 @@ -375,7 +375,7 @@ pst_rshift(st1, st2) /* * call-seq: * stat.stopped? => true or false - * + * * Returns +true+ if this process is stopped. This is only * returned if the corresponding wait call had the * WUNTRACED flag set. @@ -397,7 +397,7 @@ pst_wifstopped(st) /* * call-seq: * stat.stopsig => fixnum or nil - * + * * Returns the number of the signal that caused _stat_ to stop * (or +nil+ if self is not stopped). */ @@ -417,7 +417,7 @@ pst_wstopsig(st) /* * call-seq: * stat.signaled? => true or false - * + * * Returns +true+ if _stat_ terminated because of * an uncaught signal. */ @@ -438,7 +438,7 @@ pst_wifsignaled(st) /* * call-seq: * stat.termsig => fixnum or nil - * + * * Returns the number of the signal that caused _stat_ to * terminate (or +nil+ if self was not terminated by an * uncaught signal). @@ -459,7 +459,7 @@ pst_wtermsig(st) /* * call-seq: * stat.exited? => true or false - * + * * Returns +true+ if _stat_ exited normally (for * example using an exit() call or finishing the * program). @@ -481,16 +481,16 @@ pst_wifexited(st) /* * call-seq: * stat.exitstatus => fixnum or nil - * + * * Returns the least significant eight bits of the return code of * _stat_. Only available if exited? is * +true+. - * + * * fork { } #=> 26572 * Process.wait #=> 26572 * $?.exited? #=> true * $?.exitstatus #=> 0 - * + * * fork { exit 99 } #=> 26573 * Process.wait #=> 26573 * $?.exited? #=> true @@ -512,7 +512,7 @@ pst_wexitstatus(st) /* * call-seq: * stat.success? => true, false or nil - * + * * Returns +true+ if _stat_ is successful, +false+ if not. * Returns +nil+ if exited? is not +true+. */ @@ -532,7 +532,7 @@ pst_success_p(st) /* * call-seq: * stat.coredump? => true or false - * + * * Returns +true+ if _stat_ generated a coredump * when it terminated. Not available on all platforms. */ @@ -678,20 +678,20 @@ waitall_each(pid, status, ary) * Process.wait() => fixnum * Process.wait(pid=-1, flags=0) => fixnum * Process.waitpid(pid=-1, flags=0) => fixnum - * + * * Waits for a child process to exit, returns its process id, and * sets $? to a Process::Status object * containing information on that process. Which child it waits on * depends on the value of _pid_: - * + * * > 0:: Waits for the child whose process ID equals _pid_. - * + * * 0:: Waits for any child whose process group ID equals that of the * calling process. * * -1:: Waits for any child process (the default if no _pid_ is * given). - * + * * < -1:: Waits for any child whose process group ID equals the absolute * value of _pid_. * @@ -700,10 +700,10 @@ waitall_each(pid, status, ary) * or Process::WUNTRACED (return stopped children that * haven't been reported). Not all flags are available on all * platforms, but a flag value of zero will work on all platforms. - * + * * Calling this method raises a SystemError if there are * no child processes. Not available on all platforms. - * + * * include Process * fork { exit 99 } #=> 27429 * wait #=> 27429 @@ -749,13 +749,13 @@ proc_wait(argc, argv) * call-seq: * Process.wait2(pid=-1, flags=0) => [pid, status] * Process.waitpid2(pid=-1, flags=0) => [pid, status] - * + * * Waits for a child process to exit (see Process::waitpid for exact * semantics) and returns an array containing the process id and the * exit status (a Process::Status object) of that * child. Raises a SystemError if there are no child * processes. - * + * * Process.fork { exit 99 } #=> 27437 * pid, status = Process.wait2 * pid #=> 27437 @@ -776,11 +776,11 @@ proc_wait2(argc, argv) /* * call-seq: * Process.waitall => [ [pid1,status1], ...] - * + * * Waits for all children, returning an array of * _pid_/_status_ pairs (where _status_ is a * Process::Status object). - * + * * fork { sleep 0.2; exit 2 } #=> 27432 * fork { sleep 0.1; exit 1 } #=> 27433 * fork { exit 0 } #=> 27434 @@ -858,7 +858,7 @@ rb_detach_process(pid) /* * call-seq: * Process.detach(pid) => thread - * + * * Some operating systems retain the status of terminated child * processes until the parent collects that status (normally using * some variant of wait(). If the parent never collects @@ -877,27 +877,27 @@ rb_detach_process(pid) * * In this first example, we don't reap the first child process, so * it appears as a zombie in the process status display. - * + * * p1 = fork { sleep 0.1 } * p2 = fork { sleep 0.2 } * Process.waitpid(p2) * sleep 2 * system("ps -ho pid,state -p #{p1}") - * + * * produces: - * + * * 27389 Z - * + * * In the next example, Process::detach is used to reap * the child automatically. - * + * * p1 = fork { sleep 0.1 } * p2 = fork { sleep 0.2 } * Process.detach(p1) * Process.waitpid(p2) * sleep 2 * system("ps -ho pid,state -p #{p1}") - * + * * (produces no output) */ @@ -1211,7 +1211,7 @@ rb_check_argv(argc, argv) /* * call-seq: * exec(command [, arg, ...]) - * + * * Replaces the current process by running the given external _command_. * If +exec+ is given a single argument, that argument is * taken as a line that is subject to shell expansion before being @@ -1224,11 +1224,11 @@ rb_check_argv(argc, argv) * subshell; otherwise, one of the exec(2) system calls is * used, so the running command may inherit some of the environment of * the original program (including open file descriptors). - * + * * exec "echo *" # echoes list of files in current directory * # never get here - * - * + * + * * exec "echo", "*" # echoes an asterisk * # never get here */ @@ -1405,7 +1405,7 @@ rb_fork(status, chfunc, charg) /* * call-seq: * Process.fork [{ block }] => fixnum or nil - * + * * See Kernel::fork. */ @@ -1448,11 +1448,11 @@ rb_f_fork(obj) /* * call-seq: * Process.exit!(fixnum=-1) - * + * * Exits the process immediately. No exit handlers are * run. fixnum is returned to the underlying system as the * exit status. - * + * * Process.exit!(0) */ @@ -1547,7 +1547,7 @@ rb_spawn(argc, argv) earg.argv = argv; earg.prog = prog ? RSTRING(prog)->ptr : 0; status = rb_fork(&status, (int (*)_((void*)))rb_exec, &earg); - if (prog) argv[0] = prog; + if (prog && argc) argv[0] = prog; #elif defined HAVE_SPAWNV if (!argc) { status = proc_spawn(RSTRING(prog)->ptr); @@ -1555,9 +1555,9 @@ rb_spawn(argc, argv) else { status = proc_spawn_n(argc, argv, prog); } - if (prog) argv[0] = prog; + if (prog && argc) argv[0] = prog; #else - if (prog) argv[0] = prog; + if (prog && argc) argv[0] = prog; prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" ")); status = system(StringValuePtr(prog)); # if defined(__human68k__) || defined(__DJGPP__) @@ -1572,18 +1572,18 @@ rb_spawn(argc, argv) /* * call-seq: * system(cmd [, arg, ...]) => true or false - * + * * Executes _cmd_ in a subshell, returning +true+ if * the command was found and ran successfully, +false+ * otherwise. An error status is available in $?. The * arguments are processed in the same way as for * Kernel::exec. - * + * * system("echo *") * system("echo", "*") - * + * * produces: - * + * * config.h main.rb * * */ @@ -1632,14 +1632,14 @@ rb_f_spawn(argc, argv) /* * call-seq: * sleep(duration=0) => fixnum - * + * * Suspends the current thread for _duration_ seconds (which may be * any number, including a +Float+ with fractional seconds). Returns the actual * number of seconds slept (rounded), which may be less than that asked * for if the thread was interrupted by a +SIGALRM+, or if * another thread calls Thread#run. An argument of zero * causes +sleep+ to sleep forever. - * + * * Time.new #=> Wed Apr 09 08:56:32 CDT 2003 * sleep 1.2 #=> 1 * Time.new #=> Wed Apr 09 08:56:33 CDT 2003 @@ -1674,10 +1674,10 @@ rb_f_sleep(argc, argv) /* * call-seq: * Process.getpgrp => integer - * + * * Returns the process group ID for this process. Not available on * all platforms. - * + * * Process.getpgid(0) #=> 25527 * Process.getpgrp #=> 25527 */ @@ -1706,7 +1706,7 @@ proc_getpgrp() /* * call-seq: * Process.setpgrp => 0 - * + * * Equivalent to setpgid(0,0). Not available on all * platforms. */ @@ -1732,10 +1732,10 @@ proc_setpgrp() /* * call-seq: * Process.getpgid(pid) => integer - * + * * Returns the process group ID for the given process id. Not * available on all platforms. - * + * * Process.getpgid(Process.ppid()) #=> 25527 */ @@ -1757,7 +1757,7 @@ proc_getpgid(obj, pid) /* * call-seq: * Process.setpgid(pid, integer) => 0 - * + * * Sets the process group ID of _pid_ (0 indicates this * process) to integer. Not available on all platforms. */ @@ -1784,11 +1784,11 @@ proc_setpgid(obj, pid, pgrp) /* * call-seq: * Process.setsid => fixnum - * + * * Establishes this process as a new session and process group * leader, with no controlling tty. Returns the session id. Not * available on all platforms. - * + * * Process.setsid #=> 27422 */ @@ -1832,7 +1832,7 @@ proc_setsid() /* * call-seq: * Process.getpriority(kind, integer) => fixnum - * + * * Gets the scheduling priority for specified process, process group, * or user. kind indicates the kind of entity to find: one * of Process::PRIO_PGRP, @@ -1841,7 +1841,7 @@ proc_setsid() * indicating the particular process, process group, or user (an id * of 0 means _current_). Lower priorities are more favorable * for scheduling. Not available on all platforms. - * + * * Process.getpriority(Process::PRIO_USER, 0) #=> 19 * Process.getpriority(Process::PRIO_PROCESS, 0) #=> 19 */ @@ -1869,9 +1869,9 @@ proc_getpriority(obj, which, who) /* * call-seq: * Process.setpriority(kind, integer, priority) => 0 - * + * * See Process#getpriority. - * + * * Process.setpriority(Process::PRIO_USER, 0, 19) #=> 0 * Process.setpriority(Process::PRIO_PROCESS, 0, 19) #=> 0 * Process.getpriority(Process::PRIO_USER, 0) #=> 19 @@ -1933,10 +1933,10 @@ check_gid_switch() /* * call-seq: * Process::Sys.setuid(integer) => nil - * + * * Set the user ID of the current process to _integer_. Not * available on all platforms. - * + * */ static VALUE @@ -1957,10 +1957,10 @@ p_sys_setuid(obj, id) /* * call-seq: * Process::Sys.setruid(integer) => nil - * + * * Set the real user ID of the calling process to _integer_. * Not available on all platforms. - * + * */ static VALUE @@ -1980,10 +1980,10 @@ p_sys_setruid(obj, id) /* * call-seq: * Process::Sys.seteuid(integer) => nil - * + * * Set the effective user ID of the calling process to * _integer_. Not available on all platforms. - * + * */ static VALUE @@ -2003,7 +2003,7 @@ p_sys_seteuid(obj, id) /* * call-seq: * Process::Sys.setreuid(rid, eid) => nil - * + * * Sets the (integer) real and/or effective user IDs of the current * process to _rid_ and _eid_, respectively. A value of * -1 for either means to leave that ID unchanged. Not @@ -2028,9 +2028,9 @@ p_sys_setreuid(obj, rid, eid) /* * call-seq: * Process::Sys.setresuid(rid, eid, sid) => nil - * + * * Sets the (integer) real, effective, and saved user IDs of the - * current process to _rid_, _eid_, and _sid_ respectively. A + * current process to _rid_, _eid_, and _sid_ respectively. A * value of -1 for any value means to * leave that ID unchanged. Not available on all platforms. * @@ -2055,9 +2055,9 @@ p_sys_setresuid(obj, rid, eid, sid) * Process.uid => fixnum * Process::UID.rid => fixnum * Process::Sys.getuid => fixnum - * + * * Returns the (real) user ID of this process. - * + * * Process.uid #=> 501 */ @@ -2073,7 +2073,7 @@ proc_getuid(obj) /* * call-seq: * Process.uid= integer => numeric - * + * * Sets the (integer) user ID for this process. Not available on all * platforms. */ @@ -2108,7 +2108,7 @@ proc_setuid(obj, id) /******************************************************************** - * + * * Document-class: Process::UID * * The Process::UID module contains a collection of @@ -2123,11 +2123,11 @@ static int SAVED_USER_ID; /* * call-seq: * Process::UID.change_privilege(integer) => fixnum - * + * * Change the current process's real and effective user ID to that * specified by _integer_. Returns the new user ID. Not * available on all platforms. - * + * * [Process.uid, Process.euid] #=> [0, 0] * Process::UID.change_privilege(31) #=> 31 * [Process.uid, Process.euid] #=> [31, 31] @@ -2200,13 +2200,13 @@ p_uid_change_privilege(obj, id) #endif } else { /* unprivileged user */ #if defined(HAVE_SETRESUID) - if (setresuid((getuid() == uid)? -1: uid, - (geteuid() == uid)? -1: uid, + if (setresuid((getuid() == uid)? -1: uid, + (geteuid() == uid)? -1: uid, (SAVED_USER_ID == uid)? -1: uid) < 0) rb_sys_fail(0); SAVED_USER_ID = uid; #elif defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID) if (SAVED_USER_ID == uid) { - if (setreuid((getuid() == uid)? -1: uid, + if (setreuid((getuid() == uid)? -1: uid, (geteuid() == uid)? -1: uid) < 0) rb_sys_fail(0); } else if (getuid() != uid) { if (setreuid(uid, (geteuid() == uid)? -1: uid) < 0) rb_sys_fail(0); @@ -2278,10 +2278,10 @@ p_uid_change_privilege(obj, id) /* * call-seq: * Process::Sys.setgid(integer) => nil - * + * * Set the group ID of the current process to _integer_. Not * available on all platforms. - * + * */ static VALUE @@ -2301,10 +2301,10 @@ p_sys_setgid(obj, id) /* * call-seq: * Process::Sys.setrgid(integer) => nil - * + * * Set the real group ID of the calling process to _integer_. * Not available on all platforms. - * + * */ static VALUE @@ -2325,10 +2325,10 @@ p_sys_setrgid(obj, id) /* * call-seq: * Process::Sys.setegid(integer) => nil - * + * * Set the effective group ID of the calling process to * _integer_. Not available on all platforms. - * + * */ static VALUE @@ -2348,7 +2348,7 @@ p_sys_setegid(obj, id) /* * call-seq: * Process::Sys.setregid(rid, eid) => nil - * + * * Sets the (integer) real and/or effective group IDs of the current * process to rid and eid, respectively. A value of * -1 for either means to leave that ID unchanged. Not @@ -2372,7 +2372,7 @@ p_sys_setregid(obj, rid, eid) /* * call-seq: * Process::Sys.setresgid(rid, eid, sid) => nil - * + * * Sets the (integer) real, effective, and saved user IDs of the * current process to rid, eid, and sid * respectively. A value of -1 for any value means to @@ -2397,7 +2397,7 @@ p_sys_setresgid(obj, rid, eid, sid) /* * call-seq: * Process::Sys.issetugid => true or false - * + * * Returns +true+ if the process was created as a result * of an execve(2) system call which had either of the setuid or * setgid bits set (and extra privileges were given as a result) or @@ -2428,9 +2428,9 @@ p_sys_issetugid(obj) * Process.gid => fixnum * Process::GID.rid => fixnum * Process::Sys.getgid => fixnum - * + * * Returns the (real) group ID for this process. - * + * * Process.gid #=> 500 */ @@ -2446,7 +2446,7 @@ proc_getgid(obj) /* * call-seq: * Process.gid= fixnum => fixnum - * + * * Sets the group ID for this process. */ @@ -2485,7 +2485,7 @@ static size_t maxgroups = 32; /* * call-seq: * Process.groups => array - * + * * Get an Array of the gids of groups in the * supplemental group access list for this process. * @@ -2523,7 +2523,7 @@ proc_getgroups(VALUE obj) /* * call-seq: * Process.groups= array => array - * + * * Set the supplemental group access list to the given * Array of group IDs. * @@ -2565,7 +2565,7 @@ proc_setgroups(VALUE obj, VALUE ary) else { gr = getgrnam(RSTRING(g)->ptr); if (gr == NULL) - rb_raise(rb_eArgError, + rb_raise(rb_eArgError, "can't find group for %s", RSTRING(g)->ptr); groups[i] = gr->gr_gid; } @@ -2587,7 +2587,7 @@ proc_setgroups(VALUE obj, VALUE ary) /* * call-seq: * Process.initgroups(username, gid) => array - * + * * Initializes the supplemental group access list by reading the * system group database and using all groups of which the given user * is a member. The group with the specified gid is also @@ -2620,10 +2620,10 @@ proc_initgroups(obj, uname, base_grp) /* * call-seq: * Process.maxgroups => fixnum - * + * * Returns the maximum number of gids allowed in the supplemental * group access list. - * + * * Process.maxgroups #=> 32 */ @@ -2638,7 +2638,7 @@ proc_getmaxgroups(obj) /* * call-seq: * Process.maxgroups= fixnum => fixnum - * + * * Sets the maximum number of gids allowed in the supplemental group * access list. */ @@ -2659,7 +2659,7 @@ proc_setmaxgroups(obj, val) /******************************************************************** - * + * * Document-class: Process::GID * * The Process::GID module contains a collection of @@ -2674,7 +2674,7 @@ static int SAVED_GROUP_ID; /* * call-seq: * Process::GID.change_privilege(integer) => fixnum - * + * * Change the current process's real and effective group ID to that * specified by _integer_. Returns the new group ID. Not * available on all platforms. @@ -2752,13 +2752,13 @@ p_gid_change_privilege(obj, id) #endif } else { /* unprivileged user */ #if defined(HAVE_SETRESGID) - if (setresgid((getgid() == gid)? -1: gid, - (getegid() == gid)? -1: gid, + if (setresgid((getgid() == gid)? -1: gid, + (getegid() == gid)? -1: gid, (SAVED_GROUP_ID == gid)? -1: gid) < 0) rb_sys_fail(0); SAVED_GROUP_ID = gid; #elif defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID) if (SAVED_GROUP_ID == gid) { - if (setregid((getgid() == gid)? -1: gid, + if (setregid((getgid() == gid)? -1: gid, (getegid() == gid)? -1: gid) < 0) rb_sys_fail(0); } else if (getgid() != gid) { if (setregid(gid, (getegid() == gid)? -1: gid) < 0) rb_sys_fail(0); @@ -2831,9 +2831,9 @@ p_gid_change_privilege(obj, id) * Process.euid => fixnum * Process::UID.eid => fixnum * Process::Sys.geteuid => fixnum - * + * * Returns the effective user ID for this process. - * + * * Process.euid #=> 501 */ @@ -2849,7 +2849,7 @@ proc_geteuid(obj) /* * call-seq: * Process.euid= integer - * + * * Sets the effective user ID for this process. Not available on all * platforms. */ @@ -2919,11 +2919,11 @@ rb_seteuid_core(euid) * call-seq: * Process::UID.grant_privilege(integer) => fixnum * Process::UID.eid= integer => fixnum - * + * * Set the effective user ID, and if possible, the saved user ID of * the process to the given _integer_. Returns the new * effective user ID. Not available on all platforms. - * + * * [Process.uid, Process.euid] #=> [0, 0] * Process::UID.grant_privilege(31) #=> 31 * [Process.uid, Process.euid] #=> [0, 31] @@ -2942,10 +2942,10 @@ p_uid_grant_privilege(obj, id) * Process.egid => fixnum * Process::GID.eid => fixnum * Process::Sys.geteid => fixnum - * + * * Returns the effective group ID for this process. Not available on * all platforms. - * + * * Process.egid #=> 500 */ @@ -2962,7 +2962,7 @@ proc_getegid(obj) /* * call-seq: * Process.egid = fixnum => fixnum - * + * * Sets the effective group ID for this process. Not available on all * platforms. */ @@ -3033,11 +3033,11 @@ rb_setegid_core(egid) * call-seq: * Process::GID.grant_privilege(integer) => fixnum * Process::GID.eid = integer => fixnum - * + * * Set the effective group ID, and if possible, the saved group ID of * the process to the given _integer_. Returns the new * effective group ID. Not available on all platforms. - * + * * [Process.gid, Process.egid] #=> [0, 0] * Process::GID.grant_privilege(31) #=> 33 * [Process.gid, Process.egid] #=> [0, 33] @@ -3054,10 +3054,10 @@ p_gid_grant_privilege(obj, id) /* * call-seq: * Process::UID.re_exchangeable? => true or false - * + * * Returns +true+ if the real and effective user IDs of a * process may be exchanged on the current platform. - * + * */ static VALUE @@ -3076,10 +3076,10 @@ p_uid_exchangeable() /* * call-seq: * Process::UID.re_exchange => fixnum - * + * * Exchange real and effective user IDs and return the new effective * user ID. Not available on all platforms. - * + * * [Process.uid, Process.euid] #=> [0, 31] * Process::UID.re_exchange #=> 0 * [Process.uid, Process.euid] #=> [31, 0] @@ -3112,10 +3112,10 @@ p_uid_exchange(obj) /* * call-seq: * Process::GID.re_exchangeable? => true or false - * + * * Returns +true+ if the real and effective group IDs of a * process may be exchanged on the current platform. - * + * */ static VALUE @@ -3134,10 +3134,10 @@ p_gid_exchangeable() /* * call-seq: * Process::GID.re_exchange => fixnum - * + * * Exchange real and effective group IDs and return the new effective * group ID. Not available on all platforms. - * + * * [Process.gid, Process.egid] #=> [0, 33] * Process::GID.re_exchange #=> 0 * [Process.gid, Process.egid] #=> [33, 0] @@ -3171,10 +3171,10 @@ p_gid_exchange(obj) /* * call-seq: * Process::UID.sid_available? => true or false - * + * * Returns +true+ if the current platform has saved user * ID functionality. - * + * */ static VALUE @@ -3202,13 +3202,13 @@ p_uid_sw_ensure(id) * call-seq: * Process::UID.switch => fixnum * Process::UID.switch {|| block} => object - * + * * Switch the effective and real user IDs of the current process. If * a block is given, the user IDs will be switched back * after the block is executed. Returns the new effective user ID if * called without a block, and the return value of the block if one * is given. - * + * */ static VALUE @@ -3285,10 +3285,10 @@ p_uid_switch(obj) /* * call-seq: * Process::GID.sid_available? => true or false - * + * * Returns +true+ if the current platform has saved group * ID functionality. - * + * */ static VALUE @@ -3315,13 +3315,13 @@ p_gid_sw_ensure(id) * call-seq: * Process::GID.switch => fixnum * Process::GID.switch {|| block} => object - * + * * Switch the effective and real group IDs of the current process. If * a block is given, the group IDs will be switched back * after the block is executed. Returns the new effective group ID if * called without a block, and the return value of the block if one * is given. - * + * */ static VALUE @@ -3395,11 +3395,11 @@ p_gid_switch(obj) /* * call-seq: * Process.times => aStructTms - * + * * Returns a Tms structure (see Struct::Tms * on page 388) that contains user and system CPU times for this * process. - * + * * t = Process.times * [ t.utime, t.stime ] #=> [0.0, 0.02] */ @@ -3553,25 +3553,25 @@ Init_process() rb_define_module_function(rb_mProcGID, "rid", proc_getgid, 0); rb_define_module_function(rb_mProcUID, "eid", proc_geteuid, 0); rb_define_module_function(rb_mProcGID, "eid", proc_getegid, 0); - rb_define_module_function(rb_mProcUID, "change_privilege", + rb_define_module_function(rb_mProcUID, "change_privilege", p_uid_change_privilege, 1); - rb_define_module_function(rb_mProcGID, "change_privilege", + rb_define_module_function(rb_mProcGID, "change_privilege", p_gid_change_privilege, 1); - rb_define_module_function(rb_mProcUID, "grant_privilege", + rb_define_module_function(rb_mProcUID, "grant_privilege", p_uid_grant_privilege, 1); - rb_define_module_function(rb_mProcGID, "grant_privilege", + rb_define_module_function(rb_mProcGID, "grant_privilege", p_gid_grant_privilege, 1); rb_define_alias(rb_mProcUID, "eid=", "grant_privilege"); rb_define_alias(rb_mProcGID, "eid=", "grant_privilege"); rb_define_module_function(rb_mProcUID, "re_exchange", p_uid_exchange, 0); rb_define_module_function(rb_mProcGID, "re_exchange", p_gid_exchange, 0); - rb_define_module_function(rb_mProcUID, "re_exchangeable?", + rb_define_module_function(rb_mProcUID, "re_exchangeable?", p_uid_exchangeable, 0); - rb_define_module_function(rb_mProcGID, "re_exchangeable?", + rb_define_module_function(rb_mProcGID, "re_exchangeable?", p_gid_exchangeable, 0); - rb_define_module_function(rb_mProcUID, "sid_available?", + rb_define_module_function(rb_mProcUID, "sid_available?", p_uid_have_saved_id, 0); - rb_define_module_function(rb_mProcGID, "sid_available?", + rb_define_module_function(rb_mProcGID, "sid_available?", p_gid_have_saved_id, 0); rb_define_module_function(rb_mProcUID, "switch", p_uid_switch, 0); rb_define_module_function(rb_mProcGID, "switch", p_gid_switch, 0); @@ -3592,15 +3592,15 @@ Init_process() rb_define_module_function(rb_mProcID_Syscall, "seteuid", p_sys_seteuid, 1); rb_define_module_function(rb_mProcID_Syscall, "setegid", p_sys_setegid, 1); - rb_define_module_function(rb_mProcID_Syscall, "setreuid", + rb_define_module_function(rb_mProcID_Syscall, "setreuid", p_sys_setreuid, 2); - rb_define_module_function(rb_mProcID_Syscall, "setregid", + rb_define_module_function(rb_mProcID_Syscall, "setregid", p_sys_setregid, 2); - rb_define_module_function(rb_mProcID_Syscall, "setresuid", + rb_define_module_function(rb_mProcID_Syscall, "setresuid", p_sys_setresuid, 3); - rb_define_module_function(rb_mProcID_Syscall, "setresgid", + rb_define_module_function(rb_mProcID_Syscall, "setresgid", p_sys_setresgid, 3); - rb_define_module_function(rb_mProcID_Syscall, "issetugid", + rb_define_module_function(rb_mProcID_Syscall, "issetugid", p_sys_issetugid, 0); } -- cgit v1.2.3