Module: Process::Sys
| Relationships & Source Files | |
| Defined in: | process.c |
Overview
Class Attribute Summary
-
.geteuid ⇒ Integer
readonly
mod_func
Alias for UID.eid.
-
.getgid ⇒ Integer
readonly
mod_func
Alias for GID.rid.
-
.getuid ⇒ Integer
readonly
mod_func
Alias for UID.rid.
Class Method Summary
-
.getegid ⇒ Integer
mod_func
Alias for GID.eid.
-
.issetugid ⇒ Boolean
mod_func
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. -
.setegid(group) ⇒ nil
mod_func
Set the effective group ID of the calling process to group.
-
.seteuid(user) ⇒ nil
mod_func
Set the effective user ID of the calling process to user.
-
.setgid(group) ⇒ nil
mod_func
Set the group ID of the current process to group.
-
.setregid(rid, eid) ⇒ nil
mod_func
Sets the (group) real and/or effective group IDs of the current process to rid and eid, respectively.
-
.setresgid(rid, eid, sid) ⇒ nil
mod_func
Sets the (group) real, effective, and saved user IDs of the current process to rid, eid, and sid respectively.
-
.setresuid(rid, eid, sid) ⇒ nil
mod_func
Sets the (user) real, effective, and saved user IDs of the current process to rid, eid, and sid respectively.
-
.setreuid(rid, eid) ⇒ nil
mod_func
Sets the (user) real and/or effective user IDs of the current process to rid and eid, respectively.
-
.setrgid(group) ⇒ nil
mod_func
Set the real group ID of the calling process to group.
-
.setruid(user) ⇒ nil
mod_func
Set the real user ID of the calling process to user.
-
.setuid(user) ⇒ nil
mod_func
Set the user ID of the current process to user.
Class Attribute Details
.geteuid ⇒ Integer (readonly, mod_func)
.getgid ⇒ Integer (readonly, mod_func)
.getuid ⇒ Integer (readonly, mod_func)
Class Method Details
.getegid ⇒ Integer (mod_func)
.issetugid ⇒ Boolean (mod_func)
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', line 5710
static VALUE
p_sys_issetugid(VALUE obj)
{
if (issetugid()) {
return Qtrue;
}
else {
return Qfalse;
}
}
.setegid(group) ⇒ nil (mod_func)
Set the effective group ID of the calling process to group. Not available on all platforms.
# File 'process.c', line 5627
static VALUE
p_sys_setegid(VALUE obj, VALUE id)
{
check_gid_switch();
if (setegid(OBJ2GID(id)) != 0) rb_sys_fail(0);
return Qnil;
}
.seteuid(user) ⇒ nil (mod_func)
Set the effective user ID of the calling process to user. Not available on all platforms.
# File 'process.c', line 5247
static VALUE
p_sys_seteuid(VALUE obj, VALUE id)
{
check_uid_switch();
if (seteuid(OBJ2UID(id)) != 0) rb_sys_fail(0);
return Qnil;
}
.setgid(group) ⇒ nil (mod_func)
Set the group ID of the current process to group. Not available on all platforms.
# File 'process.c', line 5583
static VALUE
p_sys_setgid(VALUE obj, VALUE id)
{
check_gid_switch();
if (setgid(OBJ2GID(id)) != 0) rb_sys_fail(0);
return Qnil;
}
.setregid(rid, eid) ⇒ nil (mod_func)
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.
# File 'process.c', line 5651
static VALUE
p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
{
rb_gid_t rgid, egid;
PREPARE_GETGRNAM;
check_gid_switch();
rgid = OBJ2GID(rid);
egid = OBJ2GID(eid);
FINISH_GETGRNAM;
if (setregid(rgid, egid) != 0) rb_sys_fail(0);
return Qnil;
}
.setresgid(rid, eid, sid) ⇒ nil (mod_func)
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.
# File 'process.c', line 5679
static VALUE
p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
rb_gid_t rgid, egid, sgid;
PREPARE_GETGRNAM;
check_gid_switch();
rgid = OBJ2GID(rid);
egid = OBJ2GID(eid);
sgid = OBJ2GID(sid);
FINISH_GETGRNAM;
if (setresgid(rgid, egid, sgid) != 0) rb_sys_fail(0);
return Qnil;
}
.setresuid(rid, eid, sid) ⇒ nil (mod_func)
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.
# File 'process.c', line 5300
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;
}
.setreuid(rid, eid) ⇒ nil (mod_func)
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.
# File 'process.c', line 5271
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;
}
.setrgid(group) ⇒ nil (mod_func)
Set the real group ID of the calling process to group. Not available on all platforms.
# File 'process.c', line 5605
static VALUE
p_sys_setrgid(VALUE obj, VALUE id)
{
check_gid_switch();
if (setrgid(OBJ2GID(id)) != 0) rb_sys_fail(0);
return Qnil;
}
.setruid(user) ⇒ nil (mod_func)
Set the real user ID of the calling process to user. Not available on all platforms.
# File 'process.c', line 5225
static VALUE
p_sys_setruid(VALUE obj, VALUE id)
{
check_uid_switch();
if (setruid(OBJ2UID(id)) != 0) rb_sys_fail(0);
return Qnil;
}
.setuid(user) ⇒ nil (mod_func)
Set the user ID of the current process to user. Not available on all platforms.
# File 'process.c', line 5203
static VALUE
p_sys_setuid(VALUE obj, VALUE id)
{
check_uid_switch();
if (setuid(OBJ2UID(id)) != 0) rb_sys_fail(0);
return Qnil;
}