Rudiments
Static Public Member Functions
process Class Reference

List of all members.

Static Public Member Functions

static pid_t getProcessId ()
static pid_t getParentProcessId ()
static pid_t getProcessGroupId ()
static pid_t getProcessGroupId (pid_t pid)
static bool setProcessGroupId ()
static bool setProcessGroupId (pid_t pgid)
static bool setProcessGroupId (pid_t pid, pid_t pgid)
static pid_t getSessionId ()
static pid_t getSessionId (pid_t pid)
static uid_t getRealUserId ()
static uid_t getEffectiveUserId ()
static bool setUserId (uid_t uid)
static bool setEffectiveUserId (uid_t uid)
static bool setRealAndEffectiveUserId (uid_t uid, uid_t euid)
static gid_t getRealGroupId ()
static gid_t getEffectiveGroupId ()
static bool setGroupId (gid_t gid)
static bool setEffectiveGroupId (gid_t gid)
static bool setRealAndEffectiveGroupId (gid_t gid, gid_t egid)
static mode_t setFileCreationMask (mode_t mask)
static pid_t fork ()
static bool detach ()
static void exit (int32_t status)
static void exitImmediately (int32_t status)

Detailed Description

The process class provides methods for accessing information about and controlling the currently running process.


Member Function Documentation

static bool process::detach ( ) [static]

Detaches the current process from the controlling tty, creates a new session, changes directory to / and sets the file creation mask to 0. Use this method to "fork your process into the background." Returns true on success and false upon failure.

static void process::exit ( int32_t  status) [static]

Terminates the calling process and sets the exit status to "status".

static void process::exitImmediately ( int32_t  status) [static]

Terminates the calling process "immediately" (without calling any functions registered to run at exit) and sets the exit status to "status".

static pid_t process::fork ( ) [static]

Creates a child process. The child is a duplicate of the parent inheriting file descriptors and a copy of the parent's address space. The child does not have access to the parent's address space. In the parent process, the process id of the child is returned. In the child process, 0 is returned. -1 is returned if an error occurred and no child is forked.

static gid_t process::getEffectiveGroupId ( ) [static]

Returns the effective group id of the current process.

static uid_t process::getEffectiveUserId ( ) [static]

Returns the effective user id of the current process.

static pid_t process::getParentProcessId ( ) [static]

Returns the process id of the parent process of the current process.

static pid_t process::getProcessGroupId ( pid_t  pid) [static]

Returns the process group id of the process pid.

static pid_t process::getProcessGroupId ( ) [static]

Returns the process group id of the current process.

static pid_t process::getProcessId ( ) [static]

Returns the process id of the current process.

static gid_t process::getRealGroupId ( ) [static]

Returns the real group id of the current process.

static uid_t process::getRealUserId ( ) [static]

Returns the real user id of the current process.

static pid_t process::getSessionId ( ) [static]

Returns the session id of the current process.

static pid_t process::getSessionId ( pid_t  pid) [static]

Returns the session id of the process pid.

static bool process::setEffectiveGroupId ( gid_t  gid) [static]

Sets the effective group id of the current process to gid. Does not set the real or saved group id's.

Returns true on success and false on failure.

static bool process::setEffectiveUserId ( uid_t  uid) [static]

Sets the effective user id of the current process to uid. Does not set the real or saved user id's.

Returns true on success and false on failure.

static mode_t process::setFileCreationMask ( mode_t  mask) [static]

Set file/directory creation mode mask to "mask". Returns the mask that was previously in effect.

static bool process::setGroupId ( gid_t  gid) [static]

Sets the effective group id of the current process to gid. If the effective group id is root, the real and saved group id's are also set.

Returns true on success and false on failure.

static bool process::setProcessGroupId ( pid_t  pgid) [static]

Sets the process group id of the current process to pgid.

static bool process::setProcessGroupId ( ) [static]

Sets the process group id of the current process to the current process id.

static bool process::setProcessGroupId ( pid_t  pid,
pid_t  pgid 
) [static]

Sets the process group id of the process pid to pgid.

static bool process::setRealAndEffectiveGroupId ( gid_t  gid,
gid_t  egid 
) [static]

Sets the real group id of the current process to gid and the effective group id of the current process to egid. If the real group id is set or the effective group id is set to a value not equal to the previous real group id, the saved group id is set to the new effective group id.

Returns true on success and false on failure.

static bool process::setRealAndEffectiveUserId ( uid_t  uid,
uid_t  euid 
) [static]

Sets the real user id of the current process to uid and the effective user id of the current process to euid. If the real user id is set or the effective user id is set to a value not equal to the previous real user id, the saved user id is set to the new effective user id.

Returns true on success and false on failure.

static bool process::setUserId ( uid_t  uid) [static]

Sets the effective user id of the current process to uid. If the effective user id is root, the real and saved user id's are also set.

Returns true on success and false on failure.