class method
Process.getsid
(?::Integer pid) -> ::Integer
Process.getsid(pid = nil) → integer
process.c
View on GitHub ↗
static VALUE
proc_getsid(int argc, VALUE *argv, VALUE _)
{
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);
}
Returns the session ID of the given process ID pid, or of the current process if not given:
Example
Process.getsid # => 27422 Process.getsid(0) # => 27422 Process.getsid(Process.pid()) # => 27422
Not available on all platforms.