Module: Process::Sys
- Defined in:
- process.c
Overview
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.
Class Method Summary collapse
-
.getegid ⇒ Object
Returns the effective group ID for this process.
-
.geteuid ⇒ Object
Returns the effective user ID for this process.
-
.getgid ⇒ Object
Returns the (real) group ID for this process.
-
.getuid ⇒ Object
Returns the (real) user ID of this process.
-
.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. -
.Process::Sys.setegid(integer) ⇒ nil
Set the effective group ID of the calling process to integer.
-
.Process::Sys.seteuid(integer) ⇒ nil
Set the effective user ID of the calling process to integer.
-
.Process::Sys.setgid(integer) ⇒ nil
Set the group ID of the current process to integer.
-
.Process::Sys.setregid(rid, eid) ⇒ nil
Sets the (integer) real and/or effective group IDs of the current process to rid and eid, respectively.
-
.Process::Sys.setresgid(rid, eid, sid) ⇒ nil
Sets the (integer) 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 (integer) real, effective, and saved user IDs of the current process to rid, eid, and sid respectively.
-
.Process::Sys.setreuid(rid, eid) ⇒ nil
Sets the (integer) real and/or effective user IDs of the current process to rid and eid, respectively.
-
.Process::Sys.setrgid(integer) ⇒ nil
Set the real group ID of the calling process to integer.
-
.Process::Sys.setruid(integer) ⇒ nil
Set the real user ID of the calling process to integer.
-
.Process::Sys.setuid(integer) ⇒ nil
Set the user ID of the current process to integer.
Class Method Details
.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
|
# File 'process.c'
/*
* call-seq:
* 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
*/
static VALUE
proc_getegid(obj)
VALUE obj;
{
int egid = getegid();
return INT2FIX(egid);
}
|
.euid ⇒ Fixnum .Process::UID.eid ⇒ Fixnum .Process::Sys.geteuid ⇒ Fixnum
Returns the effective user ID for this process.
Process.euid #=> 501
|
# File 'process.c'
/*
* call-seq:
* Process.euid => fixnum
* Process::UID.eid => fixnum
* Process::Sys.geteuid => fixnum
*
* Returns the effective user ID for this process.
*
* Process.euid #=> 501
*/
static VALUE
proc_geteuid(obj)
VALUE obj;
{
int euid = geteuid();
return INT2FIX(euid);
}
|
.gid ⇒ Fixnum .Process::GID.rid ⇒ Fixnum .Process::Sys.getgid ⇒ Fixnum
Returns the (real) group ID for this process.
Process.gid #=> 500
|
# File 'process.c'
/*
* call-seq:
* Process.gid => fixnum
* Process::GID.rid => fixnum
* Process::Sys.getgid => fixnum
*
* Returns the (real) group ID for this process.
*
* Process.gid #=> 500
*/
static VALUE
proc_getgid(obj)
VALUE obj;
{
int gid = getgid();
return INT2FIX(gid);
}
|
.uid ⇒ Fixnum .Process::UID.rid ⇒ Fixnum .Process::Sys.getuid ⇒ Fixnum
Returns the (real) user ID of this process.
Process.uid #=> 501
|
# File 'process.c'
/*
* call-seq:
* Process.uid => fixnum
* Process::UID.rid => fixnum
* Process::Sys.getuid => fixnum
*
* Returns the (real) user ID of this process.
*
* Process.uid #=> 501
*/
static VALUE
proc_getuid(obj)
VALUE obj;
{
int uid = getuid();
return INT2FIX(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.
|
# File 'process.c'
/*
* call-seq:
* Process::Sys.issetugid => true or false
*
* 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(obj)
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
Set the effective group ID of the calling process to integer. Not available on all platforms.
|
# File 'process.c'
/*
* call-seq:
* Process::Sys.setegid(integer) => nil
*
* Set the effective group ID of the calling process to
* _integer_. Not available on all platforms.
*
*/
static VALUE
p_sys_setegid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETEGID
check_gid_switch();
if (setegid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
#endif
return Qnil;
}
|
.Process::Sys.seteuid(integer) ⇒ nil
Set the effective user ID of the calling process to integer. Not available on all platforms.
|
# File 'process.c'
/*
* call-seq:
* Process::Sys.seteuid(integer) => nil
*
* Set the effective user ID of the calling process to
* _integer_. Not available on all platforms.
*
*/
static VALUE
p_sys_seteuid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETEUID
check_uid_switch();
if (seteuid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
#endif
return Qnil;
}
|
.Process::Sys.setgid(integer) ⇒ nil
Set the group ID of the current process to integer. Not available on all platforms.
|
# File 'process.c'
/*
* call-seq:
* Process::Sys.setgid(integer) => nil
*
* Set the group ID of the current process to _integer_. Not
* available on all platforms.
*
*/
static VALUE
p_sys_setgid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETGID
check_gid_switch();
if (setgid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
#endif
return Qnil;
}
|
.Process::Sys.setregid(rid, eid) ⇒ nil
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.
|
# File 'process.c'
/*
* call-seq:
* Process::Sys.setregid(rid, eid) => nil
*
* Sets the (integer) real and/or effective group IDs of the current
* process to <em>rid</em> and <em>eid</em>, respectively. A value of
* <code>-1</code> for either means to leave that ID unchanged. Not
* available on all platforms.
*
*/
static VALUE
p_sys_setregid(obj, rid, eid)
VALUE obj, rid, eid;
{
#if defined HAVE_SETREGID
check_gid_switch();
if (setregid(NUM2INT(rid),NUM2INT(eid)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
#endif
return Qnil;
}
|
.Process::Sys.setresgid(rid, eid, sid) ⇒ nil
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.
|
# File 'process.c'
/*
* call-seq:
* Process::Sys.setresgid(rid, eid, sid) => nil
*
* Sets the (integer) real, effective, and saved user IDs of the
* current process to <em>rid</em>, <em>eid</em>, and <em>sid</em>
* respectively. A value of <code>-1</code> for any value means to
* leave that ID unchanged. Not available on all platforms.
*
*/
static VALUE
p_sys_setresgid(obj, rid, eid, sid)
VALUE obj, rid, eid, sid;
{
#if defined HAVE_SETRESGID
check_gid_switch();
if (setresgid(NUM2INT(rid),NUM2INT(eid),NUM2INT(sid)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
#endif
return Qnil;
}
|
.Process::Sys.setresuid(rid, eid, sid) ⇒ nil
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.
|
# File 'process.c'
/*
* call-seq:
* Process::Sys.setresuid(rid, eid, sid) => nil
*
* Sets the (integer) real, effective, and saved user IDs of the
* current process to _rid_, _eid_, and _sid_ respectively. A
* value of <code>-1</code> for any value means to
* leave that ID unchanged. Not available on all platforms.
*
*/
static VALUE
p_sys_setresuid(obj, rid, eid, sid)
VALUE obj, rid, eid, sid;
{
#if defined HAVE_SETRESUID
check_uid_switch();
if (setresuid(NUM2INT(rid),NUM2INT(eid),NUM2INT(sid)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
#endif
return Qnil;
}
|
.Process::Sys.setreuid(rid, eid) ⇒ nil
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.
|
# File 'process.c'
/*
* call-seq:
* Process::Sys.setreuid(rid, eid) => nil
*
* Sets the (integer) real and/or effective user IDs of the current
* process to _rid_ and _eid_, respectively. A value of
* <code>-1</code> for either means to leave that ID unchanged. Not
* available on all platforms.
*
*/
static VALUE
p_sys_setreuid(obj, rid, eid)
VALUE obj, rid, eid;
{
#if defined HAVE_SETREUID
check_uid_switch();
if (setreuid(NUM2INT(rid),NUM2INT(eid)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
#endif
return Qnil;
}
|
.Process::Sys.setrgid(integer) ⇒ nil
Set the real group ID of the calling process to integer. Not available on all platforms.
|
# File 'process.c'
/*
* call-seq:
* Process::Sys.setrgid(integer) => nil
*
* Set the real group ID of the calling process to _integer_.
* Not available on all platforms.
*
*/
static VALUE
p_sys_setrgid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETRGID
check_gid_switch();
if (setrgid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
#endif
return Qnil;
}
|
.Process::Sys.setruid(integer) ⇒ nil
Set the real user ID of the calling process to integer. Not available on all platforms.
|
# File 'process.c'
/*
* call-seq:
* Process::Sys.setruid(integer) => nil
*
* Set the real user ID of the calling process to _integer_.
* Not available on all platforms.
*
*/
static VALUE
p_sys_setruid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETRUID
check_uid_switch();
if (setruid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
#endif
return Qnil;
}
|
.Process::Sys.setuid(integer) ⇒ nil
Set the user ID of the current process to integer. Not available on all platforms.
|
# File 'process.c'
/*
* call-seq:
* Process::Sys.setuid(integer) => nil
*
* Set the user ID of the current process to _integer_. Not
* available on all platforms.
*
*/
static VALUE
p_sys_setuid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETUID
check_uid_switch();
if (setuid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
#endif
return Qnil;
}
|