class methods
|
egid |
Process.egid
-> aFixnum
|
|
Returns the effective group id for this process.
| egid= |
Process.egid= aFixnum
-> aFixnum
|
|
Sets the effective group id for this process.
| euid |
Process.euid
-> aFixnum
|
|
Returns the effective user id for this process.
| euid= |
Process.euid= aFixnum
|
|
Sets the effective user id for this process.
Not available on all platforms.
| exit! |
Process.exit!( aFixnum=-1 )
|
|
Exits the process immediately.
No exit handlers are run.
aFixnum is returned to the underlying system as the exit
status.
| fork |
Process.fork [{ block }
]
-> aFixnum or nil
|
|
See Kernel::fork on page 420.
| getpgid |
Process.getpgid( anInteger )
-> anInteger
|
|
Returns the process group id for the given process id.
Not available on all platforms.
Process.getpgid(Process.ppid()) |
» |
13790 |
| getpgrp |
Process.getpgrp
-> anInteger
|
|
Returns the process group id for this process.
Not available on all platforms.
Process.getpgid(0) |
» |
13790 |
Process.getpgrp |
» |
13790 |
| getpriority |
Process.getpriority( aKind,
anInteger ) -> aFixnum
|
|
Gets the
scheduling priority for specified process, process group, or
user. aKind indicates the kind of entity to find:
one of Process::PRIO_PGRP ,
Process::PRIO_USER , or Process::PRIO_PROCESS .
anInteger is an id indicating the particular process,
process group, or user (an id of 0 means current).
Lower priorities are more favorable for
scheduling. Not available on all platforms.
Process.getpriority(Process::PRIO_USER, 0) |
» |
0 |
Process.getpriority(Process::PRIO_PROCESS, 0) |
» |
19 |
| gid |
Process.gid
-> aFixnum
|
|
Returns the group id for this process.
| gid= |
Process.gid= aFixnum
-> aFixnum
|
|
Sets the group id for this process.
| kill |
Process.kill( aSignal,
[aPid]+ ) -> aFixnum
|
|
Sends the given signal to the specified process id(s),
or to the
current process if aPid is zero. aSignal may be an
integer signal number or a POSIX signal name (either with or
without a SIG prefix). If aSignal is negative (or
starts with a ``- '' sign), kills process groups instead
of processes. Not all signals are available on all platforms.
trap("SIGHUP") { close_then_exit }
Process.kill("SIGHUP", 0)
|
| pid |
Process.pid -> aFixnum
|
|
Returns the process id of this process.
Not available on all platforms.
| ppid |
Process.ppid -> aFixnum
|
|
Returns the process id of the parent of this process.
Always returns 0 on NT.
Not available on all platforms.
print "I am ", Process.pid, "\n"
Process.fork { print "Dad is ", Process.ppid, "\n" }
|
produces:
| setpgid |
Process.setpgid( aPid, anInteger )
-> 0
|
|
Sets the process group id of aPid (0 indicates this
process) to anInteger.
Not available on all platforms.
| setpgrp |
Process.setpgrp
-> 0
|
|
Equivalent to setpgid(0,0) .
Not available on all platforms.
| setpriority |
Process.setpriority( kind,
anInteger, anIntPriority )
-> 0
|
|
See Process#getpriority .
Process.setpriority(Process::PRIO_USER, 0, 19) |
» |
0 |
Process.setpriority(Process::PRIO_PROCESS, 0, 19) |
» |
0 |
Process.getpriority(Process::PRIO_USER, 0) |
» |
19 |
Process.getpriority(Process::PRIO_PROCESS, 0) |
» |
19 |
| setsid |
Process.setsid
-> aFixnum
|
|
Establishes this process as a new session and process group
leader, with no controlling tty.
Returns the session id.
Not available on all platforms.
| uid |
Process.uid
-> aFixnum
|
|
Returns the user id of this process.
| uid= |
Process.uid= anInteger
-> aNumeric
|
|
Sets the (integer) user id for this process.
Not available on all platforms.
| wait |
Process.wait
-> aFixnum
|
|
Waits for any child process to exit and returns the process id
of that child.
Raises a SystemError if there are no child processes.
Not available on all platforms.
Process.fork { exit 1; } |
» |
16500 |
Process.wait |
» |
16500 |
| wait2 |
Process.wait2
-> anArray
|
|
Waits for any child process to exit and returns an array
containing the process id and the exit status
of that child.
Raises a SystemError if there are no child processes.
Process.fork { exit 1 } |
» |
16503 |
Process.wait2 |
» |
[16503, 256] |
| waitpid |
Process.waitpid( aPid,
anInteger=0 )
-> aPid
|
|
Waits for the given child process to exit. anInteger may be
a logical or of the flag value
Process::WNOHANG (do not block if no child available)
or Process::WUNTRACED (return stopped children that haven't
been reported).
Not all flags are available on all platforms, but a flag value
of zero will work on all platforms.
include Process |
pid = fork { sleep 3 } |
» |
16506 |
Time.now |
» |
Sun Mar 04 23:31:14 CST 2001 |
waitpid(pid, Process::WNOHANG) |
» |
nil |
Time.now |
» |
Sun Mar 04 23:31:14 CST 2001 |
waitpid(pid, 0) |
» |
16506 |
Time.now |
» |
Sun Mar 04 23:31:17 CST 2001 |
| waitpid2 |
Process.waitpid2( aPid,
anInteger=0 )
-> anArray
|
|
Waits for the given child process to exit, returning that
child's process id and exit status. anInteger may be
a logical or of the flag value
Process::WNOHANG (do not block if no child available)
or Process::WUNTRACED (return stopped children that haven't
been reported).
Not all flags are available on all platforms, but a flag value
of zero will work on all platforms.
|