Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

Process.getsid

Process.getsid() → integer
Process.getsid(pid) → integer

Returns the session ID for the given process id. If not given, return current process sid. Not available on all platforms.

Example
Process.getsid()                #=> 27422
Process.getsid(0)               #=> 27422
Process.getsid(Process.pid())   #=> 27422
See also .getrlimit .gid .getpriority .gid= also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1