Module: Process::Sys
- Defined in:
- process.c
Class Method Summary collapse
- 
  
    
      .getegid  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Returns the effective group ID for the current process:. 
- 
  
    
      .geteuid  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Returns the effective user ID for the current process. 
- 
  
    
      .getgid  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Returns the (real) group ID for the current process:. 
- 
  
    
      .getuid  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Returns the (real) user ID of the current process. 
- 
  
    
      .Process::Sys.issetugid  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns trueif the process was created as a result of an execve(2) system call which had either of the setuid or setgid bits set (and extra privileges were given as a result) or if it has changed any of its real, effective or saved user or group IDs since it began execution.
- 
  
    
      .Process::Sys.setegid(group)  ⇒ nil 
    
    
  
  
  
  
  
  
  
  
  
    Set the effective group ID of the calling process to group. 
- 
  
    
      .Process::Sys.seteuid(user)  ⇒ nil 
    
    
  
  
  
  
  
  
  
  
  
    Set the effective user ID of the calling process to user. 
- 
  
    
      .Process::Sys.setgid(group)  ⇒ nil 
    
    
  
  
  
  
  
  
  
  
  
    Set the group ID of the current process to group. 
- 
  
    
      .Process::Sys.setregid(rid, eid)  ⇒ nil 
    
    
  
  
  
  
  
  
  
  
  
    Sets the (group) real and/or effective group IDs of the current process to rid and eid, respectively. 
- 
  
    
      .Process::Sys.setresgid(rid, eid, sid)  ⇒ nil 
    
    
  
  
  
  
  
  
  
  
  
    Sets the (group) real, effective, and saved user IDs of the current process to rid, eid, and sid respectively. 
- 
  
    
      .Process::Sys.setresuid(rid, eid, sid)  ⇒ nil 
    
    
  
  
  
  
  
  
  
  
  
    Sets the (user) real, effective, and saved user IDs of the current process to rid, eid, and sid respectively. 
- 
  
    
      .Process::Sys.setreuid(rid, eid)  ⇒ nil 
    
    
  
  
  
  
  
  
  
  
  
    Sets the (user) real and/or effective user IDs of the current process to rid and eid, respectively. 
- 
  
    
      .Process::Sys.setrgid(group)  ⇒ nil 
    
    
  
  
  
  
  
  
  
  
  
    Set the real group ID of the calling process to group. 
- 
  
    
      .Process::Sys.setruid(user)  ⇒ nil 
    
    
  
  
  
  
  
  
  
  
  
    Set the real user ID of the calling process to user. 
- 
  
    
      .Process::Sys.setuid(user)  ⇒ nil 
    
    
  
  
  
  
  
  
  
  
  
    Set the user ID of the current process to user. 
Instance Method Summary collapse
- 
  
    
      #getegid  ⇒ Object 
    
    
  
  
  
  
  private
  
  
  
  
    Returns the effective group ID for the current process:. 
- 
  
    
      #geteuid  ⇒ Object 
    
    
  
  
  
  
  private
  
  
  
  
    Returns the effective user ID for the current process. 
- 
  
    
      #getgid  ⇒ Object 
    
    
  
  
  
  
  private
  
  
  
  
    Returns the (real) group ID for the current process:. 
- 
  
    
      #getuid  ⇒ Object 
    
    
  
  
  
  
  private
  
  
  
  
    Returns the (real) user ID of the current process. 
- 
  
    
      #Process::Sys.issetugid  ⇒ Boolean 
    
    
  
  
  
  
  private
  
  
  
  
    Returns trueif the process was created as a result of an execve(2) system call which had either of the setuid or setgid bits set (and extra privileges were given as a result) or if it has changed any of its real, effective or saved user or group IDs since it began execution.
- 
  
    
      #Process::Sys.setegid(group)  ⇒ nil 
    
    
  
  
  
  
  private
  
  
  
  
    Set the effective group ID of the calling process to group. 
- 
  
    
      #Process::Sys.seteuid(user)  ⇒ nil 
    
    
  
  
  
  
  private
  
  
  
  
    Set the effective user ID of the calling process to user. 
- 
  
    
      #Process::Sys.setgid(group)  ⇒ nil 
    
    
  
  
  
  
  private
  
  
  
  
    Set the group ID of the current process to group. 
- 
  
    
      #Process::Sys.setregid(rid, eid)  ⇒ nil 
    
    
  
  
  
  
  private
  
  
  
  
    Sets the (group) real and/or effective group IDs of the current process to rid and eid, respectively. 
- 
  
    
      #Process::Sys.setresgid(rid, eid, sid)  ⇒ nil 
    
    
  
  
  
  
  private
  
  
  
  
    Sets the (group) real, effective, and saved user IDs of the current process to rid, eid, and sid respectively. 
- 
  
    
      #Process::Sys.setresuid(rid, eid, sid)  ⇒ nil 
    
    
  
  
  
  
  private
  
  
  
  
    Sets the (user) real, effective, and saved user IDs of the current process to rid, eid, and sid respectively. 
- 
  
    
      #Process::Sys.setreuid(rid, eid)  ⇒ nil 
    
    
  
  
  
  
  private
  
  
  
  
    Sets the (user) real and/or effective user IDs of the current process to rid and eid, respectively. 
- 
  
    
      #Process::Sys.setrgid(group)  ⇒ nil 
    
    
  
  
  
  
  private
  
  
  
  
    Set the real group ID of the calling process to group. 
- 
  
    
      #Process::Sys.setruid(user)  ⇒ nil 
    
    
  
  
  
  
  private
  
  
  
  
    Set the real user ID of the calling process to user. 
- 
  
    
      #Process::Sys.setuid(user)  ⇒ nil 
    
    
  
  
  
  
  private
  
  
  
  
    Set the user ID of the current process to user. 
Class Method Details
.egid ⇒ Integer .Process::GID.eid ⇒ Integer .Process::Sys.geteid ⇒ Integer
| 7440 7441 7442 7443 7444 7445 7446 | # File 'process.c', line 7440
static VALUE
proc_getegid(VALUE obj)
{
    rb_gid_t egid = getegid();
    return GIDT2NUM(egid);
} | 
.euid ⇒ Integer .Process::UID.eid ⇒ Integer .Process::Sys.geteuid ⇒ Integer
| 7314 7315 7316 7317 7318 7319 | # File 'process.c', line 7314
static VALUE
proc_geteuid(VALUE obj)
{
    rb_uid_t euid = geteuid();
    return UIDT2NUM(euid);
} | 
.gid ⇒ Integer .Process::GID.rid ⇒ Integer .Process::Sys.getgid ⇒ Integer
| 6743 6744 6745 6746 6747 6748 | # File 'process.c', line 6743
static VALUE
proc_getgid(VALUE obj)
{
    rb_gid_t gid = getgid();
    return GIDT2NUM(gid);
} | 
.uid ⇒ Integer .Process::UID.rid ⇒ Integer .Process::Sys.getuid ⇒ Integer
| 6341 6342 6343 6344 6345 6346 | # File 'process.c', line 6341
static VALUE
proc_getuid(VALUE obj)
{
    rb_uid_t uid = getuid();
    return UIDT2NUM(uid);
} | 
.Process::Sys.issetugid ⇒ Boolean
Returns true if the process was created as a result of an execve(2) system call which had either of the setuid or setgid bits set (and extra privileges were given as a result) or if it has changed any of its real, effective or saved user or group IDs since it began execution.
| 6721 6722 6723 6724 6725 | # File 'process.c', line 6721
static VALUE
p_sys_issetugid(VALUE obj)
{
    return RBOOL(issetugid());
} | 
.Process::Sys.setegid(group) ⇒ nil
Set the effective group ID of the calling process to group. Not available on all platforms.
| 6642 6643 6644 6645 6646 6647 6648 | # File 'process.c', line 6642
static VALUE
p_sys_setegid(VALUE obj, VALUE id)
{
    check_gid_switch();
    if (setegid(OBJ2GID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} | 
.Process::Sys.seteuid(user) ⇒ nil
Set the effective user ID of the calling process to user. Not available on all platforms.
| 6258 6259 6260 6261 6262 6263 6264 | # File 'process.c', line 6258
static VALUE
p_sys_seteuid(VALUE obj, VALUE id)
{
    check_uid_switch();
    if (seteuid(OBJ2UID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} | 
.Process::Sys.setgid(group) ⇒ nil
Set the group ID of the current process to group. Not available on all platforms.
| 6598 6599 6600 6601 6602 6603 6604 | # File 'process.c', line 6598
static VALUE
p_sys_setgid(VALUE obj, VALUE id)
{
    check_gid_switch();
    if (setgid(OBJ2GID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} | 
.Process::Sys.setregid(rid, eid) ⇒ nil
Sets the (group) real and/or effective group IDs of the current process to rid and eid, respectively. A value of -1 for either means to leave that ID unchanged. Not available on all platforms.
| 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 | # File 'process.c', line 6666
static VALUE
p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
{
    rb_gid_t rgid, egid;
    check_gid_switch();
    rgid = OBJ2GID(rid);
    egid = OBJ2GID(eid);
    if (setregid(rgid, egid) != 0) rb_sys_fail(0);
    return Qnil;
} | 
.Process::Sys.setresgid(rid, eid, sid) ⇒ nil
Sets the (group) real, effective, and saved user IDs of the current process to rid, eid, and sid respectively. A value of -1 for any value means to leave that ID unchanged. Not available on all platforms.
| 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 | # File 'process.c', line 6692
static VALUE
p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
    rb_gid_t rgid, egid, sgid;
    check_gid_switch();
    rgid = OBJ2GID(rid);
    egid = OBJ2GID(eid);
    sgid = OBJ2GID(sid);
    if (setresgid(rgid, egid, sgid) != 0) rb_sys_fail(0);
    return Qnil;
} | 
.Process::Sys.setresuid(rid, eid, sid) ⇒ nil
Sets the (user) real, effective, and saved user IDs of the current process to rid, eid, and sid respectively. A value of -1 for any value means to leave that ID unchanged. Not available on all platforms.
| 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 | # File 'process.c', line 6311
static VALUE
p_sys_setresuid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
    rb_uid_t ruid, euid, suid;
    PREPARE_GETPWNAM;
    check_uid_switch();
    ruid = OBJ2UID1(rid);
    euid = OBJ2UID1(eid);
    suid = OBJ2UID1(sid);
    FINISH_GETPWNAM;
    if (setresuid(ruid, euid, suid) != 0) rb_sys_fail(0);
    return Qnil;
} | 
.Process::Sys.setreuid(rid, eid) ⇒ nil
Sets the (user) real and/or effective user IDs of the current process to rid and eid, respectively. A value of -1 for either means to leave that ID unchanged. Not available on all platforms.
| 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 | # File 'process.c', line 6282
static VALUE
p_sys_setreuid(VALUE obj, VALUE rid, VALUE eid)
{
    rb_uid_t ruid, euid;
    PREPARE_GETPWNAM;
    check_uid_switch();
    ruid = OBJ2UID1(rid);
    euid = OBJ2UID1(eid);
    FINISH_GETPWNAM;
    if (setreuid(ruid, euid) != 0) rb_sys_fail(0);
    return Qnil;
} | 
.Process::Sys.setrgid(group) ⇒ nil
Set the real group ID of the calling process to group. Not available on all platforms.
| 6620 6621 6622 6623 6624 6625 6626 | # File 'process.c', line 6620
static VALUE
p_sys_setrgid(VALUE obj, VALUE id)
{
    check_gid_switch();
    if (setrgid(OBJ2GID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} | 
.Process::Sys.setruid(user) ⇒ nil
Set the real user ID of the calling process to user. Not available on all platforms.
| 6236 6237 6238 6239 6240 6241 6242 | # File 'process.c', line 6236
static VALUE
p_sys_setruid(VALUE obj, VALUE id)
{
    check_uid_switch();
    if (setruid(OBJ2UID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} | 
.Process::Sys.setuid(user) ⇒ nil
Set the user ID of the current process to user. Not available on all platforms.
| 6214 6215 6216 6217 6218 6219 6220 | # File 'process.c', line 6214
static VALUE
p_sys_setuid(VALUE obj, VALUE id)
{
    check_uid_switch();
    if (setuid(OBJ2UID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} | 
Instance Method Details
#egid ⇒ Integer (private) #Process::GID.eid ⇒ Integer (private) #Process::Sys.geteid ⇒ Integer (private)
| 7440 7441 7442 7443 7444 7445 7446 | # File 'process.c', line 7440
static VALUE
proc_getegid(VALUE obj)
{
    rb_gid_t egid = getegid();
    return GIDT2NUM(egid);
} | 
#euid ⇒ Integer (private) #Process::UID.eid ⇒ Integer (private) #Process::Sys.geteuid ⇒ Integer (private)
| 7314 7315 7316 7317 7318 7319 | # File 'process.c', line 7314
static VALUE
proc_geteuid(VALUE obj)
{
    rb_uid_t euid = geteuid();
    return UIDT2NUM(euid);
} | 
#gid ⇒ Integer (private) #Process::GID.rid ⇒ Integer (private) #Process::Sys.getgid ⇒ Integer (private)
| 6743 6744 6745 6746 6747 6748 | # File 'process.c', line 6743
static VALUE
proc_getgid(VALUE obj)
{
    rb_gid_t gid = getgid();
    return GIDT2NUM(gid);
} | 
#uid ⇒ Integer (private) #Process::UID.rid ⇒ Integer (private) #Process::Sys.getuid ⇒ Integer (private)
| 6341 6342 6343 6344 6345 6346 | # File 'process.c', line 6341
static VALUE
proc_getuid(VALUE obj)
{
    rb_uid_t uid = getuid();
    return UIDT2NUM(uid);
} | 
#Process::Sys.issetugid ⇒ Boolean (private)
Returns true if the process was created as a result of an execve(2) system call which had either of the setuid or setgid bits set (and extra privileges were given as a result) or if it has changed any of its real, effective or saved user or group IDs since it began execution.
| 6721 6722 6723 6724 6725 | # File 'process.c', line 6721
static VALUE
p_sys_issetugid(VALUE obj)
{
    return RBOOL(issetugid());
} | 
#Process::Sys.setegid(group) ⇒ nil (private)
Set the effective group ID of the calling process to group. Not available on all platforms.
| 6642 6643 6644 6645 6646 6647 6648 | # File 'process.c', line 6642
static VALUE
p_sys_setegid(VALUE obj, VALUE id)
{
    check_gid_switch();
    if (setegid(OBJ2GID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} | 
#Process::Sys.seteuid(user) ⇒ nil (private)
Set the effective user ID of the calling process to user. Not available on all platforms.
| 6258 6259 6260 6261 6262 6263 6264 | # File 'process.c', line 6258
static VALUE
p_sys_seteuid(VALUE obj, VALUE id)
{
    check_uid_switch();
    if (seteuid(OBJ2UID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} | 
#Process::Sys.setgid(group) ⇒ nil (private)
Set the group ID of the current process to group. Not available on all platforms.
| 6598 6599 6600 6601 6602 6603 6604 | # File 'process.c', line 6598
static VALUE
p_sys_setgid(VALUE obj, VALUE id)
{
    check_gid_switch();
    if (setgid(OBJ2GID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} | 
#Process::Sys.setregid(rid, eid) ⇒ nil (private)
Sets the (group) real and/or effective group IDs of the current process to rid and eid, respectively. A value of -1 for either means to leave that ID unchanged. Not available on all platforms.
| 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 | # File 'process.c', line 6666
static VALUE
p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
{
    rb_gid_t rgid, egid;
    check_gid_switch();
    rgid = OBJ2GID(rid);
    egid = OBJ2GID(eid);
    if (setregid(rgid, egid) != 0) rb_sys_fail(0);
    return Qnil;
} | 
#Process::Sys.setresgid(rid, eid, sid) ⇒ nil (private)
Sets the (group) real, effective, and saved user IDs of the current process to rid, eid, and sid respectively. A value of -1 for any value means to leave that ID unchanged. Not available on all platforms.
| 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 | # File 'process.c', line 6692
static VALUE
p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
    rb_gid_t rgid, egid, sgid;
    check_gid_switch();
    rgid = OBJ2GID(rid);
    egid = OBJ2GID(eid);
    sgid = OBJ2GID(sid);
    if (setresgid(rgid, egid, sgid) != 0) rb_sys_fail(0);
    return Qnil;
} | 
#Process::Sys.setresuid(rid, eid, sid) ⇒ nil (private)
Sets the (user) real, effective, and saved user IDs of the current process to rid, eid, and sid respectively. A value of -1 for any value means to leave that ID unchanged. Not available on all platforms.
| 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 | # File 'process.c', line 6311
static VALUE
p_sys_setresuid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
    rb_uid_t ruid, euid, suid;
    PREPARE_GETPWNAM;
    check_uid_switch();
    ruid = OBJ2UID1(rid);
    euid = OBJ2UID1(eid);
    suid = OBJ2UID1(sid);
    FINISH_GETPWNAM;
    if (setresuid(ruid, euid, suid) != 0) rb_sys_fail(0);
    return Qnil;
} | 
#Process::Sys.setreuid(rid, eid) ⇒ nil (private)
Sets the (user) real and/or effective user IDs of the current process to rid and eid, respectively. A value of -1 for either means to leave that ID unchanged. Not available on all platforms.
| 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 | # File 'process.c', line 6282
static VALUE
p_sys_setreuid(VALUE obj, VALUE rid, VALUE eid)
{
    rb_uid_t ruid, euid;
    PREPARE_GETPWNAM;
    check_uid_switch();
    ruid = OBJ2UID1(rid);
    euid = OBJ2UID1(eid);
    FINISH_GETPWNAM;
    if (setreuid(ruid, euid) != 0) rb_sys_fail(0);
    return Qnil;
} | 
#Process::Sys.setrgid(group) ⇒ nil (private)
Set the real group ID of the calling process to group. Not available on all platforms.
| 6620 6621 6622 6623 6624 6625 6626 | # File 'process.c', line 6620
static VALUE
p_sys_setrgid(VALUE obj, VALUE id)
{
    check_gid_switch();
    if (setrgid(OBJ2GID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} | 
#Process::Sys.setruid(user) ⇒ nil (private)
Set the real user ID of the calling process to user. Not available on all platforms.
| 6236 6237 6238 6239 6240 6241 6242 | # File 'process.c', line 6236
static VALUE
p_sys_setruid(VALUE obj, VALUE id)
{
    check_uid_switch();
    if (setruid(OBJ2UID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} | 
#Process::Sys.setuid(user) ⇒ nil (private)
Set the user ID of the current process to user. Not available on all platforms.
| 6214 6215 6216 6217 6218 6219 6220 | # File 'process.c', line 6214
static VALUE
p_sys_setuid(VALUE obj, VALUE id)
{
    check_uid_switch();
    if (setuid(OBJ2UID(id)) != 0) rb_sys_fail(0);
    return Qnil;
} |