Module

Process::GID

Inheritance

The Process::GID module contains a collection of module functions which can be used to portably get, set, and switch the current process‘s real, effective, and saved group IDs.

Methods

Class

Visibility Signature
public change_privilege (p1)
public eid ()
public grant_privilege (p1)
public re_exchange ()
public re_exchangeable? ()
public rid ()
public sid_available? ()
public switch ()

Class Method Detail

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.

   [Process.gid, Process.egid]          #=> [0, 0]
   Process::GID.change_privilege(33)    #=> 33
   [Process.gid, Process.egid]          #=> [33, 33]

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

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]

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]

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.

Process.gid => fixnum
Process::GID.rid => fixnum
Process::Sys.getgid => fixnum

Returns the (real) group ID for this process.

   Process.gid   #=> 500

Process::GID.sid_available? => true or false

Returns true if the current platform has saved group ID functionality.

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.