Module: Process::Sys

Defined in:
process.c

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.egidInteger .Process::GID.eidInteger .Process::Sys.geteidInteger

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

Process.egid   #=> 500

Overloads:



6920
6921
6922
6923
6924
6925
6926
# File 'process.c', line 6920

static VALUE
proc_getegid(VALUE obj)
{
    rb_gid_t egid = getegid();

    return GIDT2NUM(egid);
}

.euidInteger .Process::UID.eidInteger .Process::Sys.geteuidInteger

Returns the effective user ID for this process.

Process.euid   #=> 501

Overloads:



6796
6797
6798
6799
6800
6801
# File 'process.c', line 6796

static VALUE
proc_geteuid(VALUE obj)
{
    rb_uid_t euid = geteuid();
    return UIDT2NUM(euid);
}

.gidInteger .Process::GID.ridInteger .Process::Sys.getgidInteger

Returns the (real) group ID for this process.

Process.gid   #=> 500

Overloads:



6230
6231
6232
6233
6234
6235
# File 'process.c', line 6230

static VALUE
proc_getgid(VALUE obj)
{
    rb_gid_t gid = getgid();
    return GIDT2NUM(gid);
}

.uidInteger .Process::UID.ridInteger .Process::Sys.getuidInteger

Returns the (real) user ID of this process.

Process.uid   #=> 501

Overloads:



5827
5828
5829
5830
5831
5832
# File 'process.c', line 5827

static VALUE
proc_getuid(VALUE obj)
{
    rb_uid_t uid = getuid();
    return UIDT2NUM(uid);
}

.Process::Sys.issetugidBoolean

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.

Returns:

  • (Boolean)


6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
# File 'process.c', line 6204

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.

Returns:

  • (nil)


6125
6126
6127
6128
6129
6130
6131
# File 'process.c', line 6125

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.

Returns:

  • (nil)


5745
5746
5747
5748
5749
5750
5751
# File 'process.c', line 5745

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.

Returns:

  • (nil)


6081
6082
6083
6084
6085
6086
6087
# File 'process.c', line 6081

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.

Returns:

  • (nil)


6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
# File 'process.c', line 6149

static VALUE
p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
{
    rb_gid_t rgid, egid;
    check_gid_switch();
    rgid = OBJ2GID(rid);
    egid = OBJ2GID(eid);
    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.

Returns:

  • (nil)


6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
# File 'process.c', line 6175

static VALUE
p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
    rb_gid_t rgid, egid, sgid;
    check_gid_switch();
    rgid = OBJ2GID(rid);
    egid = OBJ2GID(eid);
    sgid = OBJ2GID(sid);
    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.

Returns:

  • (nil)


5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
# File 'process.c', line 5798

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.

Returns:

  • (nil)


5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
# File 'process.c', line 5769

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.

Returns:

  • (nil)


6103
6104
6105
6106
6107
6108
6109
# File 'process.c', line 6103

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.

Returns:

  • (nil)


5723
5724
5725
5726
5727
5728
5729
# File 'process.c', line 5723

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.

Returns:

  • (nil)


5701
5702
5703
5704
5705
5706
5707
# File 'process.c', line 5701

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

#egidInteger (private) #Process::GID.eidInteger (private) #Process::Sys.geteidInteger (private)

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

Process.egid   #=> 500

Overloads:



6920
6921
6922
6923
6924
6925
6926
# File 'process.c', line 6920

static VALUE
proc_getegid(VALUE obj)
{
    rb_gid_t egid = getegid();

    return GIDT2NUM(egid);
}

#euidInteger (private) #Process::UID.eidInteger (private) #Process::Sys.geteuidInteger (private)

Returns the effective user ID for this process.

Process.euid   #=> 501

Overloads:



6796
6797
6798
6799
6800
6801
# File 'process.c', line 6796

static VALUE
proc_geteuid(VALUE obj)
{
    rb_uid_t euid = geteuid();
    return UIDT2NUM(euid);
}

#gidInteger (private) #Process::GID.ridInteger (private) #Process::Sys.getgidInteger (private)

Returns the (real) group ID for this process.

Process.gid   #=> 500

Overloads:



6230
6231
6232
6233
6234
6235
# File 'process.c', line 6230

static VALUE
proc_getgid(VALUE obj)
{
    rb_gid_t gid = getgid();
    return GIDT2NUM(gid);
}

#uidInteger (private) #Process::UID.ridInteger (private) #Process::Sys.getuidInteger (private)

Returns the (real) user ID of this process.

Process.uid   #=> 501

Overloads:



5827
5828
5829
5830
5831
5832
# File 'process.c', line 5827

static VALUE
proc_getuid(VALUE obj)
{
    rb_uid_t uid = getuid();
    return UIDT2NUM(uid);
}

#Process::Sys.issetugidBoolean (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.

Returns:

  • (Boolean)


6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
# File 'process.c', line 6204

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.

Returns:

  • (nil)


6125
6126
6127
6128
6129
6130
6131
# File 'process.c', line 6125

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.

Returns:

  • (nil)


5745
5746
5747
5748
5749
5750
5751
# File 'process.c', line 5745

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.

Returns:

  • (nil)


6081
6082
6083
6084
6085
6086
6087
# File 'process.c', line 6081

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.

Returns:

  • (nil)


6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
# File 'process.c', line 6149

static VALUE
p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
{
    rb_gid_t rgid, egid;
    check_gid_switch();
    rgid = OBJ2GID(rid);
    egid = OBJ2GID(eid);
    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.

Returns:

  • (nil)


6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
# File 'process.c', line 6175

static VALUE
p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
    rb_gid_t rgid, egid, sgid;
    check_gid_switch();
    rgid = OBJ2GID(rid);
    egid = OBJ2GID(eid);
    sgid = OBJ2GID(sid);
    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.

Returns:

  • (nil)


5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
# File 'process.c', line 5798

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.

Returns:

  • (nil)


5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
# File 'process.c', line 5769

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.

Returns:

  • (nil)


6103
6104
6105
6106
6107
6108
6109
# File 'process.c', line 6103

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.

Returns:

  • (nil)


5723
5724
5725
5726
5727
5728
5729
# File 'process.c', line 5723

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.

Returns:

  • (nil)


5701
5702
5703
5704
5705
5706
5707
# File 'process.c', line 5701

static VALUE
p_sys_setuid(VALUE obj, VALUE id)
{
    check_uid_switch();
    if (setuid(OBJ2UID(id)) != 0) rb_sys_fail(0);
    return Qnil;
}