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
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 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
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 ⇒ 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
6130 6131 6132 6133 6134 6135 6136 |
# File 'process.c', line 6130 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
6004 6005 6006 6007 6008 6009 |
# File 'process.c', line 6004 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
5452 5453 5454 5455 5456 5457 |
# File 'process.c', line 5452 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
5044 5045 5046 5047 5048 5049 |
# File 'process.c', line 5044 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.
5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 |
# File 'process.c', line 5425 static VALUE p_sys_issetugid(VALUE obj) { rb_secure(2); 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.
5350 5351 5352 5353 5354 5355 5356 5357 |
# File 'process.c', line 5350 static VALUE p_sys_setegid(VALUE obj, VALUE id) { PREPARE_GETGRNAM; 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.
4970 4971 4972 4973 4974 4975 4976 4977 |
# File 'process.c', line 4970 static VALUE p_sys_seteuid(VALUE obj, VALUE id) { PREPARE_GETPWNAM; 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.
5304 5305 5306 5307 5308 5309 5310 5311 |
# File 'process.c', line 5304 static VALUE p_sys_setgid(VALUE obj, VALUE id) { PREPARE_GETGRNAM; 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.
5375 5376 5377 5378 5379 5380 5381 5382 |
# File 'process.c', line 5375 static VALUE p_sys_setregid(VALUE obj, VALUE rid, VALUE eid) { PREPARE_GETGRNAM; check_gid_switch(); if (setregid(OBJ2GID(rid), OBJ2GID(eid)) != 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.
5399 5400 5401 5402 5403 5404 5405 5406 |
# File 'process.c', line 5399 static VALUE p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid) { PREPARE_GETGRNAM; check_gid_switch(); if (setresgid(OBJ2GID(rid), OBJ2GID(eid), OBJ2GID(sid)) != 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.
5020 5021 5022 5023 5024 5025 5026 5027 |
# File 'process.c', line 5020 static VALUE p_sys_setresuid(VALUE obj, VALUE rid, VALUE eid, VALUE sid) { PREPARE_GETPWNAM; check_uid_switch(); if (setresuid(OBJ2UID(rid), OBJ2UID(eid), OBJ2UID(sid)) != 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.
4995 4996 4997 4998 4999 5000 5001 5002 |
# File 'process.c', line 4995 static VALUE p_sys_setreuid(VALUE obj, VALUE rid, VALUE eid) { PREPARE_GETPWNAM; check_uid_switch(); if (setreuid(OBJ2UID(rid), OBJ2UID(eid)) != 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.
5327 5328 5329 5330 5331 5332 5333 5334 |
# File 'process.c', line 5327 static VALUE p_sys_setrgid(VALUE obj, VALUE id) { PREPARE_GETGRNAM; 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.
4947 4948 4949 4950 4951 4952 4953 4954 |
# File 'process.c', line 4947 static VALUE p_sys_setruid(VALUE obj, VALUE id) { PREPARE_GETPWNAM; 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.
4924 4925 4926 4927 4928 4929 4930 4931 |
# File 'process.c', line 4924 static VALUE p_sys_setuid(VALUE obj, VALUE id) { PREPARE_GETPWNAM; 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
6130 6131 6132 6133 6134 6135 6136 |
# File 'process.c', line 6130 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
6004 6005 6006 6007 6008 6009 |
# File 'process.c', line 6004 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
5452 5453 5454 5455 5456 5457 |
# File 'process.c', line 5452 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
5044 5045 5046 5047 5048 5049 |
# File 'process.c', line 5044 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.
5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 |
# File 'process.c', line 5425 static VALUE p_sys_issetugid(VALUE obj) { rb_secure(2); 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.
5350 5351 5352 5353 5354 5355 5356 5357 |
# File 'process.c', line 5350 static VALUE p_sys_setegid(VALUE obj, VALUE id) { PREPARE_GETGRNAM; 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.
4970 4971 4972 4973 4974 4975 4976 4977 |
# File 'process.c', line 4970 static VALUE p_sys_seteuid(VALUE obj, VALUE id) { PREPARE_GETPWNAM; 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.
5304 5305 5306 5307 5308 5309 5310 5311 |
# File 'process.c', line 5304 static VALUE p_sys_setgid(VALUE obj, VALUE id) { PREPARE_GETGRNAM; 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.
5375 5376 5377 5378 5379 5380 5381 5382 |
# File 'process.c', line 5375 static VALUE p_sys_setregid(VALUE obj, VALUE rid, VALUE eid) { PREPARE_GETGRNAM; check_gid_switch(); if (setregid(OBJ2GID(rid), OBJ2GID(eid)) != 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.
5399 5400 5401 5402 5403 5404 5405 5406 |
# File 'process.c', line 5399 static VALUE p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid) { PREPARE_GETGRNAM; check_gid_switch(); if (setresgid(OBJ2GID(rid), OBJ2GID(eid), OBJ2GID(sid)) != 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.
5020 5021 5022 5023 5024 5025 5026 5027 |
# File 'process.c', line 5020 static VALUE p_sys_setresuid(VALUE obj, VALUE rid, VALUE eid, VALUE sid) { PREPARE_GETPWNAM; check_uid_switch(); if (setresuid(OBJ2UID(rid), OBJ2UID(eid), OBJ2UID(sid)) != 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.
4995 4996 4997 4998 4999 5000 5001 5002 |
# File 'process.c', line 4995 static VALUE p_sys_setreuid(VALUE obj, VALUE rid, VALUE eid) { PREPARE_GETPWNAM; check_uid_switch(); if (setreuid(OBJ2UID(rid), OBJ2UID(eid)) != 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.
5327 5328 5329 5330 5331 5332 5333 5334 |
# File 'process.c', line 5327 static VALUE p_sys_setrgid(VALUE obj, VALUE id) { PREPARE_GETGRNAM; 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.
4947 4948 4949 4950 4951 4952 4953 4954 |
# File 'process.c', line 4947 static VALUE p_sys_setruid(VALUE obj, VALUE id) { PREPARE_GETPWNAM; 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.
4924 4925 4926 4927 4928 4929 4930 4931 |
# File 'process.c', line 4924 static VALUE p_sys_setuid(VALUE obj, VALUE id) { PREPARE_GETPWNAM; check_uid_switch(); if (setuid(OBJ2UID(id)) != 0) rb_sys_fail(0); return Qnil; } |