method
getsid
ruby latest stable - Class:
Process
getsid(*args)public
Returns the session ID for the given process id. If not given, return current process sid. Not available on all platforms.
Process .getsid () #=> 27422 Process .getsid (0) #=> 27422 Process .getsid (Process .pid ()) #=> 27422
static VALUE
proc_getsid(int argc, VALUE *argv)
{
rb_pid_t sid;
rb_pid_t pid = 0;
if (rb_check_arity(argc, 0, 1) == 1 && !NIL_P(argv[0]))
pid = NUM2PIDT(argv[0]);
sid = getsid(pid);
if (sid < 0) rb_sys_fail(0);
return PIDT2NUM(sid);
}