Interface
_exit
/*
static */ void _exit( int code )
Terminates the process
immediately with exit code code and
without flushing or closing the I/O buffers.
action
/*
static */ os_signal_action action( os_sig_t signal
)
Returns the action that
the object would perform if it received signal .
Throws: os_unix_toolkit_error
action
/*
static */ void action( const vector< os_sig_t >& signals
, const os_signal_action& action
)
Sets the action
associated with all signals in signals to action
.
Throws: os_unix_toolkit_error
action
/*
static */ void action( os_sig_t signal ,
const os_signal_action& action )
Sets the action
associated with signal to action
.
Throws: os_unix_toolkit_error
add_exit_function
/*
static */ void add_exit_function( void (*f)()
)
Adds f
to the list of functions that automatically execute when the object exits.
These functions execute immediately prior to the standard I/O exit
processing.
Throws: os_unix_toolkit_error
add_exit_function
/*
static */ void add_exit_function( void (*f)(
int,... ), caddr_t arg )
Adds f
to the list of functions that automatically execute with argument arg
when the object exits. These functions execute immediately prior to the
standard I/O exit processing. On exit, the registered functions are called
as f ( status, arg ),
where status is the argument passed to exit()
, causing the object to terminate.
Throws: os_unix_toolkit_error
argument_limit
/*
static */ long argument_limit()
Returns the system limit
for the total length of the argument list passed to exec
(in bytes).
Throws: os_unix_toolkit_error
become_process_group_leader
/*
static */ void become_process_group_leader()
Makes this process a
process group leader.
Throws: os_unix_toolkit_error
become_session_leader
/*
static */ void become_session_leader()
Makes the object a
session leader. If the object is already a session leader, this action
fails. Otherwise, the object becomes a new session leader and the leader of
a new process group.
Throws: os_unix_toolkit_error
block
/*
static */ void block( const vector< os_sig_t >& signals
)
Adds the signals in signals
to the set of blocked signals.
Throws: os_unix_toolkit_error
block
/*
static */ void block( os_sig_t signal )
Adds signal
to the set of blocked signals.
Throws: os_unix_toolkit_error
blocked_signals
/*
static */ vector< os_sig_t > blocked_signals()
Returns the current
vector of blocked signals. Note that this does not imply the signal is
actually pending, but that the signal will pend if sent to the process. To
determine which signals in the blocked vector are pending delivery, use pending_signals()
.
Throws: os_unix_toolkit_error
blocked_signals
/*
static */ void blocked_signals( const vector< os_sig_t >& signals
)
Sets the vector of
blocked signals to signals .
cd
/*
static */ void cd( const string& dirpath
)
Same as the UNIX or shell
command cd [ dirpath ]
.
Throws: os_unix_toolkit_error
children_limit
/*
static */ long children_limit()
Returns the system limit
for the maximum number of processes per real user ID.
Throws: os_unix_toolkit_error
core_resource
/*
static */ os_resource core_resource()
Returns the maximum
number of bytes that the object can core dump.
core_resource
/*
static */ void core_resource( const os_resource& resource
)
Sets the maximum number
of bytes in the core file to resource .
Throws: os_unix_toolkit_error
cpu_resource
/*
static */ os_resource cpu_resource()
Returns the maximum
number of CPU seconds that the object can use. When this soft limit is
exceeded, the object is sent a SIGXCPU signal.
cpu_resource
/*
static */ void cpu_resource( const os_resource& resource
)
Sets the maximum number
of CPU seconds to resource .
Throws: os_unix_toolkit_error
data_resource
/*
static */ os_resource data_resource()
Returns the maximum size
of the data segment, in bytes. When this soft limit is exceeded, the new
operator returns nil (0).
data_resource
/*
static */ void data_resource( const os_resource& resource
)
Sets the maximum data
segment size, in bytes, to resource .
Throws: os_unix_toolkit_error
effective_group
/*
static */ void effective_group( os_gid_t group
)
Sets the effective group
to group . The process must have superuser
privileges or have a real, effective, or saved group equal to group
.
Throws: os_unix_toolkit_error
effective_group
/*
static */ os_gid_t effective_group()
Returns the effective
group.
effective_user
/*
static */ os_uid_t effective_user()
Returns the effective
user.
effective_user
/*
static */ void effective_user( os_uid_t user
)
Sets the effective user
to user . The process must have superuser
privileges or have a real, effective, or saved user equal to user
.
Throws: os_unix_toolkit_error
environment
/*
static */ void environment( const os_environment& env
)
Sets the environment to a
copy of env .
Throws: os_unix_toolkit_error
environment
/*
static */ os_environment environment()
Returns a copy of the
environment.
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( const os_environment* env
, os_desc_t send
, os_desc_t receive
, os_desc_t error
, const char* name
, const char* argv[]
)
Executes the program name
using the null-terminated argument list argv ,
environment env , send channel send
, receive channel receive , and error channel error
.
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( const os_environment* env
, os_desc_t send
, os_desc_t receive
, os_desc_t error
, const char* name
)
Executes the program name
using environment env , send channel send
, receive channel receive , and error channel error
.
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( int (*f)()
)
Executes the function f
.
execute
/*
static */ void execute( const char* shell, const char* command )
Executes the command command
using the shell shell .
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( const os_environment* env
, os_desc_t send
, os_desc_t receive
, os_desc_t error
, int (*f)(
int argc ,
const char* argv[]
), const char* argv[]
)
Executes the function f
using the null-terminated argument list argv ,
environment env , send channel send
, receive channel receive , and error channel error
.
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( const os_environment* env
, os_desc_t send
, os_desc_t receive
, os_desc_t error
, const char* shell
, const char* command
)
Executes the command command
using the shell shell , environment env
, send channel send , receive channel receive
, and error channel error .
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( const os_environment* env
, os_desc_t send
, os_desc_t receive
, os_desc_t error
, int (*f)()
)
Executes the function f
using the environment env , send channel send
, receive channel receive , and error channel error
.
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( int (*f)(
int argc ,
const char* argv[]
), const char* arg0 ,
const char* arg1 ,...
)
Executes the function f
using the null-terminated variable argument list.
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( const os_environment* env
, os_desc_t send
, os_desc_t receive
, os_desc_t error
, int (*f)(
int argc ,
const char* argv[]),
const char* arg0 ,
const char* arg1 ,...
)
Executes the function f
using the null-terminated variable argument list, environment env
, send channel send , receive channel receive
, and error channel error .
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( const char* name ,
const char* arg1 ,
const char* arg2 ,...
)
Executes the program name
using the null-terminated variable argument list.
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( const char* name ,
const char* argv[]
)
Executes the program name
using the null-terminated argument list argv .
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( const char* name )
Executes the program name
.
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( const os_environment* env
, os_desc_t send
, os_desc_t receive
, os_desc_t error
, const char* name
, const char* arg1
, const char* arg2
,... )
Executes the program name
using the null-terminated variable argument list, environment env
, send channel send , receive channel receive
, and error channel error .
Throws: os_unix_toolkit_error
execute
/*
static */ void execute( int (*f )(
int argc ,
const char* argv[]
), const char* argv[]
)
Executes the function f
using the null-terminated argument list argv .
Terminate the argv list with a zero.
exit
/*
static */ void exit( int code )
Terminates this process
with exit code code after flushing and closing the
I/O buffers. Note that exit can cause static
object destructors to be called, which in turn could generate events.
file_size_resource
/*
static */ void file_size_resource( const os_resource& resource
)
Sets the maximum size
file that the object can create, in bytes, to resource
.
Throws: os_unix_toolkit_error
file_size_resource
/*
static */ os_resource file_size_resource()
Returns the maximum size
file that the object can create, in bytes. When this soft limit is exceeded,
the object is sent a SIGXFSZ signal and
subsequent writes to the file fail.
fork
/*
static */ os_pid_t fork()
Creates a child process.
Returns the child process to the parent, and the parent process to the
child. The child process contains every thread the object does.
Throws: os_unix_toolkit_error
fork_alone
/*
static */ os_pid_t fork_alone()
Creates a child process.
Returns the child process to the parent and the parent process to the child.
The child process only contains the thread that caused the fork.
Throws: os_unix_toolkit_error
fork_and_is_child
/*
static */ bool fork_and_is_child()
Spawns a child. Both the
parent and child return from this function. The parent returns false
; the child returns true .
Throws: os_unix_toolkit_error
group
/*
static */ os_gid_t group()
Returns the real group.
hangup
/*
static */ void hangup()
Sends this process a
hangup signal.
Throws: os_unix_toolkit_error
has_job_control
/*
static */ bool has_job_control()
Returns true
if the system supports job control.
Throws: os_unix_toolkit_error
has_saveable_ids
/*
static */ bool has_saveable_ids()
Returns true
if the system supports saved set-group-IDs and saved set-user-IDs.
Throws: os_unix_toolkit_error
ignore
/*
static */ void ignore( const vector< os_sig_t >& signals
)
Ignores the signals in signals
.
Throws: os_unix_toolkit_error
ignore
/*
static */ void ignore( os_sig_t signal )
Ignores the signal signal
.
Throws: os_unix_toolkit_error
interrupt
/*
static */ void interrupt()
Sends this process an
interrupt signal.
Throws: os_unix_toolkit_error
keyboard_suspend
/*
static */ void keyboard_suspend()
Sends this process a
keyboard stop signal. This stop signal is normally generated by a Ctrl-Z
and suspends the execution.
Throws: os_unix_toolkit_error
kill
/*
static */ void kill()
Sends this process a kill
signal.
Throws: os_unix_toolkit_error
lock_data
/*
static */ void lock_data()
Locks the data segment
into physical memory.
Throws: os_unix_toolkit_error
lock_text
/*
static */ void lock_text()
Locks the text segment
into physical memory.
Throws: os_unix_toolkit_error
lock_text_and_data
/*
static */ void lock_text_and_data()
Locks the text and data
segments into physical memory.
Throws: os_unix_toolkit_error
memory_resource
/*
static */ os_resource memory_resource()
Returns the maximum size
of the address space, in bytes.
memory_resource
/*
static */ void memory_resource( const os_resource& resource
)
Sets the maximum size of
the address space, in bytes, to resource .
Throws: os_unix_toolkit_error
open_file_limit
/*
static */ long open_file_limit()
Returns the system limit
for the maximum number of open files per process.
Throws: os_unix_toolkit_error
open_file_resource
/*
static */ void open_file_resource( const os_resource& resource
)
Sets to
resource the maximum number of files the object can have open
simultaneously.
Throws: os_unix_toolkit_error
open_file_resource
/*
static */ os_resource open_file_resource()
Returns the maximum
number of files that the object can have open simultaneously. When this soft
limit is exceeded, subsequent file opens and duplications fail.
open_stream_limit
/*
static */ long open_stream_limit()
Returns the system limit
for the maximum number of standard I/O streams per process at any given
time.
Throws: os_unix_toolkit_error
parent
/*
static */ os_pid_t parent()
Returns the parent
process.
pause
/*
static */ void pause( const vector< os_sig_t >& signals
)
Waits for any signal that
is not currently being ignored and is not in signals
. Any actions associated with the incoming signal are executed before the
object returns from this call.
Throws: os_unix_toolkit_error
pause
/*
static */ void pause()
Waits for any signal that
is not currently being ignored. Any actions associated with the incoming
signal are executed before the object returns from this call.
Throws: os_unix_toolkit_error
pending_signals
/*
static */ vector< os_sig_t > pending_signals()
Returns the vector of
currently pending signals. Any signal being blocked is pending in the
operating system and is not delivered until unblocked. This message can be
used to determine which signals are pending without actually unblocking
them.
Throws: os_unix_toolkit_error
pid
/*
static */ os_pid_t pid()
Returns the process ID.
priority
/*
static */ void priority( int value )
Sets the execution
priority (nice) value to value . The range varies
between platforms, but is usually -20 (highest priority) to 20 (lowest
priority). Only a process with superuser privileges can lower a priority.
Throws: os_unix_toolkit_error
priority
/*
static */ int priority()
Returns the execution
priority (nice) value. The range varies slightly between platforms, but is
usually -20 (highest priority) to 20 (lowest priority).
Throws: os_unix_toolkit_error
process_group
/*
static */ void process_group( os_pid_t group
)
Sets the process group to
group .
Throws: os_unix_toolkit_error
process_group
/*
static */ os_pid_t process_group()
Returns the process
group.
Throws: os_unix_toolkit_error
process_group_limit
/*
static */ long process_group_limit()
Returns the system limit
for the maximum number of supplementary process group IDs per process.
Throws: os_unix_toolkit_error
profile_timer
/*
static */ os_interval_timer profile_timer()
Returns the profile
interval timer.
quit
/*
static */ void quit()
Sends this process a quit
signal.
Throws: os_unix_toolkit_error
real_and_effective_group
/*
static */ void real_and_effective_group( os_gid_t group
)
Sets the real and
effective group to group . The process must have
superuser privileges or have a real, effective, or saved group equal to group
.
Throws: os_unix_toolkit_error
real_and_effective_user
/*
static */ void real_and_effective_user( os_uid_t user
)
Sets the real and
effective user to user . The process must have
superuser privileges or have a real, effective, or saved user equal to user
.
Throws: os_unix_toolkit_error
real_group
/*
static */ os_gid_t real_group()
Returns the real group.
real_timer
/*
static */ os_interval_timer real_timer()
Returns the real interval
timer.
real_user
/*
static */ os_uid_t real_user()
Returns the real user.
resident_set_resource
/*
static */ void resident_set_resource( const os_resource& resource
)
Sets the maximum size of
the resident set size, in bytes, to resource .
Throws: os_unix_toolkit_error
resident_set_resource
/*
static */ os_resource resident_set_resource()
Returns the maximum size
of the resident set size, in bytes. When this limit is exceeded, the
resident pages may be paged out.
restore_default
/*
static */ void restore_default( const vector< os_sig_t >& signals
)
Sets the actions
associated with the signals in signals to their
defaults.
Throws: os_unix_toolkit_error
restore_default
/*
static */ void restore_default( os_sig_t signal
)
Sets the action
associated with signal to its default.
Throws: os_unix_toolkit_error
resume
/*
static */ void resume()
Sends this process a
continue signal. This signal resumes the execution if the object was
suspended.
Throws: os_unix_toolkit_error
root_directory
/*
static */ void root_directory( const string& dirpath
)
Sets the root directory
to dirpath .
Throws: os_unix_toolkit_error
set_alarm
/*
static */ os_interval_timer set_alarm( const os_time_period& interval
)
Sets the real time
interval timer to expire in interval and returns
the timer.
Throws: os_unix_toolkit_error
set_repeat_alarm
/*
static */ os_interval_timer set_repeat_alarm( const os_time_period& interval
)
Sets the real time
interval timer to expire every interval time
period and returns the timer.
Throws: os_unix_toolkit_error
signal
/*
static */ void signal( os_sig_t signal )
Sends this process the
signal with code signal . The process must have
superuser privileges or an effective or saved user ID that matches the real
or effective user ID. An exception is the SIGCONT
signal, which can be sent to any process in the same session as the sender.
Throws: os_unix_toolkit_error
signal_all
/*
static */ void signal_all( os_sig_t signal )
Sends the signal with
code signal to all processes that have the real or
effective user ID.
Throws: os_unix_toolkit_error
sleep
/*
static */ os_time_period sleep( const os_time_period& interval
)
Suspends the execution
until the interval of time expires. This message
calls sleep() . If a signal is received during
sleep, the amount of remaining time is returned. In a multithreaded
environment, os_this_thread::sleep() should be
used instead.
stack_resource
/*
static */ void stack_resource( const os_resource& resource
)
Sets the maximum size of
the stack, in bytes, to resource .
Throws: os_unix_toolkit_error
stack_resource
/*
static */ os_resource stack_resource()
Returns the maximum size
of the stack, in bytes.
supplemental_groups
/*
static */ void supplemental_groups( const vector< os_gid_t >& groups
)
Sets the supplementary
groups to be the groups . The process must have
superuser permissions to execute this function.
Throws: os_unix_toolkit_error
supplemental_groups
vector<
os_gid_t > supplemental_groups()
Returns a vector of the
group IDs. This vector is the same as obtained by os_this_process::user().groups()
unless modified by supplemental_groups( groups )
.
Throws: os_unix_toolkit_error
suspend
/*
static */ void suspend()
Sends this process a stop
signal, which suspends the execution and is only valid for systems that
support job control.
Throws: os_unix_toolkit_error
system
/*
static */ os_process_status system( const string& command
)
Executes command
using the library function system() and returns
its status.
terminate
/*
static */ void terminate()
Sends this process a
terminate signal, which is the default signal sent when the kill(1)
UNIX command is executed.
Throws: os_unix_toolkit_error
umask
/*
static */ void umask( os_mode_t mask )
Sets the file creation
mask to mask .
umask
/*
static */ os_mode_t umask()
Returns the file creation
mask.
unblock
/*
static */ void unblock( const vector< os_sig_t>& signals
)
Removes the signals in signals
from the vector of blocked signals.
Throws: os_unix_toolkit_error
unblock
/*
static */ void unblock( os_sig_t signal )
Removes signal
from the vector of blocked signals.
Throws: os_unix_toolkit_error
unlock
/*
static */ void unlock()
Unlocks the text and data
segments.
Throws: os_unix_toolkit_error
usage
/*
static */ os_resource_usage usage()
Returns the current
resource usage.
usage_for_terminated_children
/*
static */ os_resource_usage usage_for_terminated_children()
Returns the sum of
resource usage for all terminated children.
user
/*
static */ os_uid_t user()
Returns the real user.
virtual_timer
/*
static */ os_interval_timer virtual_timer()
Returns the virtual
interval timer.
wait_for_any_child
/*
static */ os_process_status wait_for_any_child( int flags
)
Waits for any child using
flags and returns the child's status.
Throws: os_unix_toolkit_error
wait_for_any_child_in
/*
static */ os_process_status wait_for_any_child_in( os_pid_t pgid
, int flags
)
Waits for any child in
the process group pgid using flags
and returns the child's status.
Throws: os_unix_toolkit_error
wait_for_any_child_in_my_group
/*
static */ os_process_status wait_for_any_child_in_my_group( int flags
)
Waits for any child in
the process group using flags and returns the
child's status.
Throws: os_unix_toolkit_error
wait_for_child
/*
static */ os_process_status wait_for_child( os_pid_t pid
, int flags
)
Waits for any of the
child processes with PID pid using flags
and returns the child's status.
Throws: os_unix_toolkit_error
working_directory
/*
static */ os_path working_directory()
Returns the current
working directory.
Throws: os_unix_toolkit_error
working_directory
/*
static */ void working_directory( const string& dirpath
)
Changes the current
working directory to dirpath , which can be
absolute or relative.
Throws: os_unix_toolkit_error