24#ifndef OMNIEVENTS__DAEMON_UNIX_H
25#define OMNIEVENTS__DAEMON_UNIX_H
28# error("This file is not intended for Windows.")
81 static void log(
const char* message);
95 int openFileFor(
int fd,
const char* filename,
int flags);
Utility class that contains various methods for running omniEvents as a Unix daemon.
void runningOk()
Called to signal that all startup operations have completed OK.
void foreground(bool val)
Set _foreground.
void tracefile(const char *val)
Set _tracefile.
int openFileFor(int fd, const char *filename, int flags)
Opens a (new?) file called 'filename' for writing, and uses it to hijack stream 'fd'.
int _pipe[2]
Unnamed pipe for child->parent comms.
void checkPidfileOrShutdown()
If pidfile exists & contains a running process then shutdown() (Unix).
void pidfile(const char *val)
Set _pidfile.
int waitForChild()
Called by the parent process (Unix).
void notifyParent(int status)
Tells the parent to exit with the given status (Unix).
static void log(const char *message)
Callback, used as a parameter to omniORB::setLogFunction().
char * _tracefile
The tracefile name (if any).
bool _foreground
TRUE for debug mode (run in foreground)
void daemonize()
Puts the current process into the background.
void initialize(int &, char **&)
Does nothing on Unix.
bool _haveSyslog
Should we close syslog before quitting?
char * _pidfile
The pidfile name (if any).
void redirectStreamsTo(const char *filename)
Redirect stdout & stderr to filename.
void shutdown(int status)
Exit handler called (indirectly) by ::on_exit() - shuts down the daemon.
void fork()
Performs the actual fork.
bool _haveParent
Is there a parent for us to clean up?
bool _havePidfile
Is there a pidfile for us to clean up?