Reference

Process(3cc)

A class for containing portable process related functions that help create portable code. Peocess wrapper class.

NAME

Process - A class for containing portable process related functions that help create portable code. Peocess wrapper class.

SYNOPSIS

#include <process.h>

Public Types

typedef RETSIGTYPE(* Trap )(int)

Static Public Methods

void detach (void)
Detach current process into a daemon, posix only. Trap setPosixSignal (int signo, Trap handler)
Set a posix compliant signal handler. Trap setInterruptSignal (int signo, Trap handler)
Set system call interuptable signal handler. int spawn (const char *exec, const char **argv)
Spawn a process and wait for it's exit code. const char * getEnv (const char *name)
Get system environment. void setEnv (const char *name, const char *value, bool overwrite)
Set system environment in a standard manner.

DETAILED DESCRIPTION

A class for containing portable process related functions that help create portable code. Peocess wrapper class.

These are typically referenced thru Process::xxx static member functions. Many of these members are used both for win32 and posix systems although some may be platform specific.

Author: David Sugar <[email protected]>

MEMBER TYPEDEF DOCUMENTATION

typedef RETSIGTYPE(* Process::Trap)(int)

MEMBER FUNCTION DOCUMENTATION

void Process::detach (void) [static]

Detach current process into a daemon, posix only.

Perhaps a similar method can be used for creating win32 'services'?

const char* Process::getEnv (const char * name) [static]

Get system environment.

Returns: system environ symbol.

Parameters:

name

of symbol.

void Process::setEnv (const char * name, const char * value, bool overwrite) [static]

Set system environment in a standard manner.

Parameters:

name

of environment symbol to set.

value

of environment symbol.

overwrite

true if replace existing symbol.

Trap Process::setInterruptSignal (int signo, Trap handler) [static]

Set system call interuptable signal handler.

return previous handler.

Parameters:

signo

signal no.

handler

trap handler.

Trap Process::setPosixSignal (int signo, Trap handler) [static]

Set a posix compliant signal handler.

Returns: previous handler.

Parameters:

signo

signal no.

handler

trap handler.

int Process::spawn (const char * exec, const char ** argv) [static]

Spawn a process and wait for it's exit code.

In win32 this is done with the spawn system call. In posix, this is done with a fork, an execvp, and a waitpid.

Warning: The implementation differences between posix and win32 systems may cause side effects. For instance, if you use atexit() and this spawn method, on posix systems the function set up with atexit() will be called when the parent process of the fork exits, which will not happen on Win32 systems.

Returns: error code from process.

Parameters:

exec

name of executable.

argv

list of command arguments.

AUTHOR

Generated automatically by Doxygen for CommonC++ from the source code.