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