process.h
// Copyright (c) 1999-2018 David Muse
// See the COPYING file for more information.
#ifndef RUDIMENTS_PROCESS_H
#define RUDIMENTS_PROCESS_H
#include <rudiments/private/processincludes.h>
enum childstatechange {
EXIT_CHILDSTATECHANGE=0,
TERMINATED_CHILDSTATECHANGE,
STOPPED_CHILDSTATECHANGE,
CONTINUED_CHILDSTATECHANGE
};
class RUDIMENTS_DLLSPEC process {
public:
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 pid_t newSession();
static uid_t getUserId();
static uid_t getEffectiveUserId();
static bool setUserId(uid_t uid);
static bool setUser(const char *username);
static bool setEffectiveUserId(uid_t uid);
static bool setEffectiveUser(const char *username);
static bool setRealAndEffectiveUserId(uid_t uid,
uid_t euid);
static gid_t getGroupId();
static gid_t getEffectiveGroupId();
static bool setGroupId(gid_t gid);
static bool setGroup(const char *groupname);
static bool setEffectiveGroupId(gid_t gid);
static bool setEffectiveGroup(const char *groupname);
static bool setRealAndEffectiveGroupId(gid_t gid,
gid_t egid);
static mode_t setFileCreationMask(mode_t mask);
static pid_t fork();
static bool supportsFork();
static bool exec(const char *command,
const char * const *args);
static pid_t spawn(const char *command,
const char * const *args,
bool detached);
static bool detach();
static void exit(int32_t status);
static void exitImmediately(int32_t status);
static bool sendSignal(pid_t processid, int32_t signum);
static bool raiseSignal(int32_t signum);
static bool atExit(void (*function)(void));
static void exitOnCrashOrShutDown();
static int64_t checkForPidFile(const char *filename);
static bool createPidFile(const char *filename,
mode_t permissions);
static void exitOnShutDown();
static void handleShutDown(
void (*shutdownfunction)(int32_t));
static void exitOnCrash();
static void handleCrash(void (*crashfunction)(int32_t));
static void waitForChildren();
static void dontWaitForChildren();
static bool wait(pid_t pid);
static bool wait(pid_t pid, int32_t *exitstatus);
static pid_t getChildStateChange(pid_t pid,
bool wait,
bool ignorestop,
bool ignorecontinue,
childstatechange *newstate,
int32_t *exitstatus,
int32_t *signum,
bool *coredump);
static bool supportsGetChildStateChange();
static void retryFailedFork();
static void dontRetryFailedFork();
static bool getRetryFailedFork();
static void backtrace(output *out, uint32_t maxframes);
static void backtrace(output *out);
static void backtrace(const char *filename);
static void backtrace(const char *filename,
mode_t perms,
uint32_t maxframes);
#include <rudiments/private/process.h>
};
#endif
output
Definition: output.h:9
permissions
Definition: permissions.h:28
process
Definition: process.h:19
process::setEffectiveUser
static bool setEffectiveUser(const char *username)
process::backtrace
static void backtrace(output *out, uint32_t maxframes)
process::getProcessGroupId
static pid_t getProcessGroupId(pid_t pid)
process::exec
static bool exec(const char *command, const char *const *args)
process::setEffectiveUserId
static bool setEffectiveUserId(uid_t uid)
process::newSession
static pid_t newSession()
process::exitImmediately
static void exitImmediately(int32_t status)
process::getSessionId
static pid_t getSessionId()
process::waitForChildren
static void waitForChildren()
process::setUserId
static bool setUserId(uid_t uid)
process::retryFailedFork
static void retryFailedFork()
process::setRealAndEffectiveGroupId
static bool setRealAndEffectiveGroupId(gid_t gid, gid_t egid)
process::setEffectiveGroup
static bool setEffectiveGroup(const char *groupname)
process::setUser
static bool setUser(const char *username)
process::getGroupId
static gid_t getGroupId()
process::getEffectiveGroupId
static gid_t getEffectiveGroupId()
process::atExit
static bool atExit(void(*function)(void))
process::getSessionId
static pid_t getSessionId(pid_t pid)
process::fork
static pid_t fork()
process::exitOnCrash
static void exitOnCrash()
process::setGroupId
static bool setGroupId(gid_t gid)
process::setProcessGroupId
static bool setProcessGroupId(pid_t pid, pid_t pgid)
process::getChildStateChange
static pid_t getChildStateChange(pid_t pid, bool wait, bool ignorestop, bool ignorecontinue, childstatechange *newstate, int32_t *exitstatus, int32_t *signum, bool *coredump)
process::setEffectiveGroupId
static bool setEffectiveGroupId(gid_t gid)
process::supportsFork
static bool supportsFork()
process::wait
static bool wait(pid_t pid)
process::setGroup
static bool setGroup(const char *groupname)
process::handleShutDown
static void handleShutDown(void(*shutdownfunction)(int32_t))
process::exit
static void exit(int32_t status)
process::getParentProcessId
static pid_t getParentProcessId()
process::setProcessGroupId
static bool setProcessGroupId(pid_t pgid)
process::getUserId
static uid_t getUserId()
process::dontRetryFailedFork
static void dontRetryFailedFork()
process::spawn
static pid_t spawn(const char *command, const char *const *args, bool detached)
process::exitOnCrashOrShutDown
static void exitOnCrashOrShutDown()
process::getEffectiveUserId
static uid_t getEffectiveUserId()
process::backtrace
static void backtrace(const char *filename)
process::setProcessGroupId
static bool setProcessGroupId()
process::sendSignal
static bool sendSignal(pid_t processid, int32_t signum)
process::checkForPidFile
static int64_t checkForPidFile(const char *filename)
process::getRetryFailedFork
static bool getRetryFailedFork()
process::dontWaitForChildren
static void dontWaitForChildren()
process::setRealAndEffectiveUserId
static bool setRealAndEffectiveUserId(uid_t uid, uid_t euid)
process::detach
static bool detach()
process::raiseSignal
static bool raiseSignal(int32_t signum)
process::wait
static bool wait(pid_t pid, int32_t *exitstatus)
process::getProcessGroupId
static pid_t getProcessGroupId()
process::handleCrash
static void handleCrash(void(*crashfunction)(int32_t))
process::supportsGetChildStateChange
static bool supportsGetChildStateChange()
process::exitOnShutDown
static void exitOnShutDown()
process::createPidFile
static bool createPidFile(const char *filename, mode_t permissions)
process::backtrace
static void backtrace(const char *filename, mode_t perms, uint32_t maxframes)
process::getProcessId
static pid_t getProcessId()
process::backtrace
static void backtrace(output *out)
process::setFileCreationMask
static mode_t setFileCreationMask(mode_t mask)