Go to the documentation of this file.
44 #ifndef COMMONCPP_PROCESS_H_
45 #define COMMONCPP_PROCESS_H_
47 #ifndef COMMONCPP_CONFIG_H_
48 #include <commoncpp/config.h>
51 #ifndef COMMONCPP_THREAD_H_
76 typedef void (*Trap)(int);
92 static void attach(
const char *devname);
144 static int spawn(
const char *exec,
const char **argv,
bool wait =
true);
162 static bool cancel(
int pid,
int sig = 0);
170 static const char *
getEnv(
const char *name);
179 static void setEnv(
const char *name,
const char *value,
bool overwrite);
207 static bool setUser(
const char *
id,
bool grp =
true);
static void setScheduler(const char *policy)
Used to set process scheduling policy.
static bool cancel(int pid, int sig=0)
Cancel a running child process.
void unlock(void)
Unlock process pages.
static Trap setPosixSignal(int signo, Trap handler)
Set a posix compliant signal handler.
bool isLocked(void)
Flag if the current process has aqcuired a lock.
This class is used to create a "named" lock entity that can be used to control access to a resource b...
static int join(int pid)
Get the exit status of another process, waiting for it to exit.
bool lock(bool future=true)
Lock a process in memory.
static int spawn(const char *exec, const char **argv, bool wait=true)
Spawn a process and wait for it's exit code.
static const char * getHomeDir(void)
Get home directory.
static const char * getEnv(const char *name)
Get system environment.
void unlock(void)
Release an acquired lock.
Common C++ thread class and sychronization objects.
static const char * getConfigDir(void)
Get etc prefix path.
static Trap setInterruptSignal(int signo, Trap handler)
Set system call interuptable signal handler.
static bool isScheduler(void)
Return true if scheduler settable.
~Lockfile()
Destroy the current lock and release it.
static size_t getPageSize(void)
Return the effective operating system page size.
bool lock(const char *name)
Lock a system-wide name for this process.
A class for containing portable process related functions that help create portable code.
static void setEnv(const char *name, const char *value, bool overwrite)
Set system environment in a standard manner.
static void detach(void)
Detach current process into a daemon, posix only.
static bool setGroup(const char *id)
Set the effective group id by name.
static void attach(const char *devname)
Attach the current process to another device or i/o session.
static const char * getUser(void)
Get user name.
Lockfile(const char *name)
Create a lock under a known name.
Lockfile()
Create a new lock object that can be used to make locks.
static void setPriority(int pri)
Used to set process priority and optionally enable realtime.
static bool isRealtime(void)
Return true if realtime scheduling.
static void setRealtime(int pri=0)
Portable shortcut for setting realtime...
static bool setUser(const char *id, bool grp=true)
Set user id by name.