Module: Process::Sys
- Defined in:
- process.c
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(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 this process.
-
#geteuid ⇒ Object
private
Returns the effective user ID for this process.
-
#getgid ⇒ Object
private
Returns the (real) group ID for this process.
-
#getuid ⇒ Object
private
Returns the (real) user ID of this process.
-
#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. -
#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 ⇒ 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
6374 6375 6376 6377 6378 6379 6380 |
# File 'process.c', line 6374 static VALUE proc_getegid(VALUE obj) { rb_gid_t egid = getegid(); return GIDT2NUM(egid); } |
.euid ⇒ Fixnum .Process::UID.eid ⇒ Fixnum .Process::Sys.geteuid ⇒ Fixnum
Returns the effective user ID for this process.
Process.euid #=> 501
6250 6251 6252 6253 6254 6255 |
# File 'process.c', line 6250 static VALUE proc_geteuid(VALUE obj) { rb_uid_t euid = geteuid(); return UIDT2NUM(euid); } |
.gid ⇒ Fixnum .Process::GID.rid ⇒ Fixnum .Process::Sys.getgid ⇒ Fixnum
Returns the (real) group ID for this process.
Process.gid #=> 500
5700 5701 5702 5703 5704 5705 |
# File 'process.c', line 5700 static VALUE proc_getgid(VALUE obj) { rb_gid_t gid = getgid(); return GIDT2NUM(gid); } |
.uid ⇒ Fixnum .Process::UID.rid ⇒ Fixnum .Process::Sys.getuid ⇒ Fixnum
Returns the (real) user ID of this process.
Process.uid #=> 501
5293 5294 5295 5296 5297 5298 |
# File 'process.c', line 5293 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.
5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 |
# File 'process.c', line 5674 static VALUE p_sys_issetugid(VALUE obj) { if (issetugid()) { return Qtrue; } else { return Qfalse; } } |
.Process::Sys.setegid(group) ⇒ nil
Set the effective group ID of the calling process to group. Not available on all platforms.
5591 5592 5593 5594 5595 5596 5597 |
# File 'process.c', line 5591 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.
5211 5212 5213 5214 5215 5216 5217 |
# File 'process.c', line 5211 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.
5547 5548 5549 5550 5551 5552 5553 |
# File 'process.c', line 5547 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.
5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 |
# File 'process.c', line 5615 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; } |
.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.
5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 |
# File 'process.c', line 5643 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; } |
.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.
5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 |
# File 'process.c', line 5264 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.
5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 |
# File 'process.c', line 5235 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.
5569 5570 5571 5572 5573 5574 5575 |
# File 'process.c', line 5569 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.
5189 5190 5191 5192 5193 5194 5195 |
# File 'process.c', line 5189 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.
5167 5168 5169 5170 5171 5172 5173 |
# File 'process.c', line 5167 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 ⇒ Fixnum (private) #Process::GID.eid ⇒ Fixnum (private) #Process::Sys.geteid ⇒ Fixnum (private)
Returns the effective group ID for this process. Not available on all platforms.
Process.egid #=> 500
6374 6375 6376 6377 6378 6379 6380 |
# File 'process.c', line 6374 static VALUE proc_getegid(VALUE obj) { rb_gid_t egid = getegid(); return GIDT2NUM(egid); } |
#euid ⇒ Fixnum (private) #Process::UID.eid ⇒ Fixnum (private) #Process::Sys.geteuid ⇒ Fixnum (private)
Returns the effective user ID for this process.
Process.euid #=> 501
6250 6251 6252 6253 6254 6255 |
# File 'process.c', line 6250 static VALUE proc_geteuid(VALUE obj) { rb_uid_t euid = geteuid(); return UIDT2NUM(euid); } |
#gid ⇒ Fixnum (private) #Process::GID.rid ⇒ Fixnum (private) #Process::Sys.getgid ⇒ Fixnum (private)
Returns the (real) group ID for this process.
Process.gid #=> 500
5700 5701 5702 5703 5704 5705 |
# File 'process.c', line 5700 static VALUE proc_getgid(VALUE obj) { rb_gid_t gid = getgid(); return GIDT2NUM(gid); } |
#uid ⇒ Fixnum (private) #Process::UID.rid ⇒ Fixnum (private) #Process::Sys.getuid ⇒ Fixnum (private)
Returns the (real) user ID of this process.
Process.uid #=> 501
5293 5294 5295 5296 5297 5298 |
# File 'process.c', line 5293 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.
5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 |
# File 'process.c', line 5674 static VALUE p_sys_issetugid(VALUE obj) { if (issetugid()) { return Qtrue; } else { return Qfalse; } } |
#Process::Sys.setegid(group) ⇒ nil (private)
Set the effective group ID of the calling process to group. Not available on all platforms.
5591 5592 5593 5594 5595 5596 5597 |
# File 'process.c', line 5591 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.
5211 5212 5213 5214 5215 5216 5217 |
# File 'process.c', line 5211 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.
5547 5548 5549 5550 5551 5552 5553 |
# File 'process.c', line 5547 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.
5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 |
# File 'process.c', line 5615 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; } |
#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.
5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 |
# File 'process.c', line 5643 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; } |
#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.
5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 |
# File 'process.c', line 5264 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.
5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 |
# File 'process.c', line 5235 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.
5569 5570 5571 5572 5573 5574 5575 |
# File 'process.c', line 5569 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.
5189 5190 5191 5192 5193 5194 5195 |
# File 'process.c', line 5189 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.
5167 5168 5169 5170 5171 5172 5173 |
# File 'process.c', line 5167 static VALUE p_sys_setuid(VALUE obj, VALUE id) { check_uid_switch(); if (setuid(OBJ2UID(id)) != 0) rb_sys_fail(0); return Qnil; } |