In Files

  • process.c

Process::Sys

The Process::Sys module contains UID and GID functions which provide direct bindings to the system calls of the same names instead of the more-portable versions of the same functionality found in the Process, Process::UID, and Process::GID modules.

Public Class Methods

egid => fixnum click to toggle source
Process::GID.eid => fixnum
Process::Sys.geteid => fixnum

Returns the effective group ID for this process. Not available on all platforms.

Process.egid   #=> 500
 
               static VALUE
proc_getegid(VALUE obj)
{
    rb_gid_t egid = getegid();

    return GIDT2NUM(egid);
}
            
euid => fixnum click to toggle source
Process::UID.eid => fixnum
Process::Sys.geteuid => fixnum

Returns the effective user ID for this process.

Process.euid   #=> 501
 
               static VALUE
proc_geteuid(VALUE obj)
{
    rb_uid_t euid = geteuid();
    return UIDT2NUM(euid);
}
            
gid => fixnum click to toggle source
Process::GID.rid => fixnum
Process::Sys.getgid => fixnum

Returns the (real) group ID for this process.

Process.gid   #=> 500
 
               static VALUE
proc_getgid(VALUE obj)
{
    rb_gid_t gid = getgid();
    return GIDT2NUM(gid);
}
            
uid => fixnum click to toggle source
Process::UID.rid => fixnum
Process::Sys.getuid => fixnum

Returns the (real) user ID of this process.

Process.uid   #=> 501
 
               static VALUE
proc_getuid(VALUE obj)
{
    rb_uid_t uid = getuid();
    return UIDT2NUM(uid);
}
            
Process::Sys.issetugid => true or false click to toggle source

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.

 
               static VALUE
p_sys_issetugid(VALUE obj)
{
#if defined HAVE_ISSETUGID
    rb_secure(2);
    if (issetugid()) {
        return Qtrue;
    } else {
        return Qfalse;
    }
#else
    rb_notimplement();
    return Qnil;                /* not reached */
#endif
}
            
Process::Sys.setegid(integer) => nil click to toggle source

Set the effective group ID of the calling process to integer. Not available on all platforms.

 
               static VALUE
p_sys_setegid(VALUE obj, VALUE id)
{
#if defined HAVE_SETEGID
    check_gid_switch();
    if (setegid(NUM2GIDT(id)) != 0) rb_sys_fail(0);
#else
    rb_notimplement();
#endif
    return Qnil;
}
            
Process::Sys.seteuid(integer) => nil click to toggle source

Set the effective user ID of the calling process to integer. Not available on all platforms.

 
               static VALUE
p_sys_seteuid(VALUE obj, VALUE id)
{
#if defined HAVE_SETEUID
    check_uid_switch();
    if (seteuid(NUM2UIDT(id)) != 0) rb_sys_fail(0);
#else
    rb_notimplement();
#endif
    return Qnil;
}
            
Process::Sys.setgid(integer) => nil click to toggle source

Set the group ID of the current process to integer. Not available on all platforms.

 
               static VALUE
p_sys_setgid(VALUE obj, VALUE id)
{
#if defined HAVE_SETGID
    check_gid_switch();
    if (setgid(NUM2GIDT(id)) != 0) rb_sys_fail(0);
#else
    rb_notimplement();
#endif
    return Qnil;
}
            
Process::Sys.setregid(rid, eid) => nil click to toggle source

Sets the (integer) 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.

 
               static VALUE
p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
{
#if defined HAVE_SETREGID
    check_gid_switch();
    if (setregid(NUM2GIDT(rid),NUM2GIDT(eid)) != 0) rb_sys_fail(0);
#else
    rb_notimplement();
#endif
    return Qnil;
}
            
Process::Sys.setresgid(rid, eid, sid) => nil click to toggle source

Sets the (integer) 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.

 
               static VALUE
p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
#if defined HAVE_SETRESGID
    check_gid_switch();
    if (setresgid(NUM2GIDT(rid),NUM2GIDT(eid),NUM2GIDT(sid)) != 0) rb_sys_fail(0);
#else
    rb_notimplement();
#endif
    return Qnil;
}
            
Process::Sys.setresuid(rid, eid, sid) => nil click to toggle source

Sets the (integer) 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.

 
               static VALUE
p_sys_setresuid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
#if defined HAVE_SETRESUID
    check_uid_switch();
    if (setresuid(NUM2UIDT(rid),NUM2UIDT(eid),NUM2UIDT(sid)) != 0) rb_sys_fail(0);
#else
    rb_notimplement();
#endif
    return Qnil;
}
            
Process::Sys.setreuid(rid, eid) => nil click to toggle source

Sets the (integer) 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.

 
               static VALUE
p_sys_setreuid(VALUE obj, VALUE rid, VALUE eid)
{
#if defined HAVE_SETREUID
    check_uid_switch();
    if (setreuid(NUM2UIDT(rid),NUM2UIDT(eid)) != 0) rb_sys_fail(0);
#else
    rb_notimplement();
#endif
    return Qnil;
}
            
Process::Sys.setrgid(integer) => nil click to toggle source

Set the real group ID of the calling process to integer. Not available on all platforms.

 
               static VALUE
p_sys_setrgid(VALUE obj, VALUE id)
{
#if defined HAVE_SETRGID
    check_gid_switch();
    if (setrgid(NUM2GIDT(id)) != 0) rb_sys_fail(0);
#else
    rb_notimplement();
#endif
    return Qnil;
}
            
Process::Sys.setruid(integer) => nil click to toggle source

Set the real user ID of the calling process to integer. Not available on all platforms.

 
               static VALUE
p_sys_setruid(VALUE obj, VALUE id)
{
#if defined HAVE_SETRUID
    check_uid_switch();
    if (setruid(NUM2UIDT(id)) != 0) rb_sys_fail(0);
#else
    rb_notimplement();
#endif
    return Qnil;
}
            
Process::Sys.setuid(integer) => nil click to toggle source

Set the user ID of the current process to integer. Not available on all platforms.

 
               static VALUE
p_sys_setuid(VALUE obj, VALUE id)
{
#if defined HAVE_SETUID
    check_uid_switch();
    if (setuid(NUM2UIDT(id)) != 0) rb_sys_fail(0);
#else
    rb_notimplement();
#endif
    return Qnil;
}