Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

Process Class Reference

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

#include <process.h>

List of all members.

Public Types

typedef RETSIGTYPE(* Trap )(int)

Static Public Member Functions

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 <dyfet@ostel.com>


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.


The documentation for this class was generated from the following file:
Generated on Thu Sep 25 13:14:32 2003 for GNU CommonC++ by doxygen 1.3.3