Feature #6757 ยป 0001-process.c-add-Process.getsid.patch
configure.in | ||
---|---|---|
getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
|
||
getpriority getrlimit setrlimit sysconf close getpwnam_r getgrnam_r\
|
||
dlopen sigprocmask sigaction sigsetjmp _setjmp _longjmp\
|
||
setsid telldir seekdir fchmod cosh sinh tanh log2 round llabs\
|
||
getsid setsid telldir seekdir fchmod cosh sinh tanh log2 round llabs\
|
||
setuid setgid daemon select_large_fdset setenv unsetenv\
|
||
mktime timegm gmtime_r clock_gettime gettimeofday poll ppoll\
|
||
pread sendfile shutdown sigaltstack dl_iterate_phdr\
|
process.c | ||
---|---|---|
#endif
|
||
#ifdef HAVE_GETSID
|
||
/*
|
||
* call-seq:
|
||
* Process.getsid(pid) -> integer
|
||
*
|
||
* Returns the session ID for this process. Not available on
|
||
* all platforms.
|
||
*
|
||
* Process.getsid(0) #=> 27422
|
||
* Process.getsid(Process.pid()) #=> 27422
|
||
*/
|
||
static VALUE
|
||
proc_getsid(VALUE obj, VALUE pid)
|
||
{
|
||
rb_pid_t sid;
|
||
rb_secure(2);
|
||
sid = getsid(NUM2PIDT(pid));
|
||
if (sid < 0) rb_sys_fail(0);
|
||
return PIDT2NUM(sid);
|
||
}
|
||
#else
|
||
#define proc_getsid rb_f_notimplement
|
||
#endif
|
||
#if defined(HAVE_SETSID) || (defined(HAVE_SETPGRP) && defined(TIOCNOTTY))
|
||
#if !defined(HAVE_SETSID)
|
||
static rb_pid_t ruby_setsid(void);
|
||
... | ... | |
rb_define_module_function(rb_mProcess, "getpgid", proc_getpgid, 1);
|
||
rb_define_module_function(rb_mProcess, "setpgid", proc_setpgid, 2);
|
||
rb_define_module_function(rb_mProcess, "getsid", proc_getsid, 1);
|
||
rb_define_module_function(rb_mProcess, "setsid", proc_setsid, 0);
|
||
rb_define_module_function(rb_mProcess, "getpriority", proc_getpriority, 2);
|