prev - up - next - index

Process

The module for operating (UNIX) processes. Like Math module, all methods defined in this module are module functions.

Notice the Process is not a class for process object, but the module for methods to operate processes.

Module Attributes:

egid

Returns the current effective group ID of the process.

egid= gid

Sets the current effective group ID of the process to gid.

euid

Returns the current effective user ID of the process.

euid= uid

Sets the current effective user ID of the process to uid.

gid

Returns the current real group ID of the process.

gid= gid

Sets the current real group ID of the process to gid.

pid

Returns the process ID of the process, which is same as the value of the variable `$$'.

ppid

Returns the process ID of the parent process. Under UN*X, the process ID will be 1 (the pid of init) after the parent process terminates.

uid

Returns the real user ID of the process.

uid= uid

Sets the real user ID of the process to uid.

Module Functions:

getpgrp([pid])

Returns the current process group for the pid, 0 for the current process. If PID is omitted, returns process group of current process.

getpriority(which, who)

Returns the current priority for a process, a process group, or a user. (See getpriority(2).) The Process module defines the constants for which, PRIO_PROCESS, PRIO_PGRP, PRIO_USER.

kill(signal, pid...)

Sends signal to the specified pid. signal must be a string or a integer to specify the signal to send. If the signal is negative (or - before the signal name), it kills process groups instead of processes.

setpgrp(pid, pgrp)

Sets the current process group for the PID, 0 for the current process.

setpriority(which, who, prio)

Sets the current priority for a process, a process group, or a user. (See setpriority(2).) The Process module defines the constants for which, PRIO_PROCESS, PRIO_PGRP, PRIO_USER.

setsid()

Creates a new session, and detaches tty. Returns the session ID of the new session.

wait

Waits for a child process to terminate and returns the pid of the deceased process, or raise Errno::ECHILD if there are no child processes.

waitpid(pid, flags)

Waits for a particular child process specified by pid to terminate and returns the pid of the deceased process, or raise Errno::ECHILD if there is no such child process. Returns nil if the process did not terminated yet in the non-blocking mode. Non-blocking wait is only available on machines supporting either the waitpid(2) or wait4(2) system calls. However, waiting for a particular pid with FLAGS of nil or 0 is implemented everywhere.

Constants:

PRIO_PROCESS

Specifies process priority for getpriority/setpriority.

PRIO_PGRP

Specifies process group priority.

PRIO_USER

Specifies user priority.

WNOHANG

Means to return immediately if no child has exited.

WUNTRACED

Means to also return for children which are stopped, and whose status has not been reported.


prev - up - next - index

matz@netlab.co.jp