poser
A C framework for POsix SERvices
|
Options for running a service. More...
#include <poser/core/runopts.h>
Static Public Member Functions | |
void | PSC_RunOpts_init (const char *pidfile) |
Initialize to default values. | |
void | PSC_RunOpts_runas (long uid, long gid) |
Run as a different user. | |
void | PSC_RunOpts_enableDefaultLogging (const char *logident) |
Handle logging using default options. | |
void | PSC_RunOpts_foreground (void) |
Run in foreground. | |
void | PSC_RunOpts_nowait (void) |
Don't wait for successful service startup. | |
Options for running a service.
These options are used by PSC_Service and PSC_Daemon.
|
static |
Handle logging using default options.
This will automatically configure logging during service startup.
When running daemonized (default), it will log to syslog as well as stderr and stop logging to stderr as soon as the service startup completed. It will also enable asynchronous logging after successful startup.
When running in foreground, it will just configure logging to stderr.
logident | name to use for syslog logging (default: posercore) |
|
static |
Run in foreground.
When this is set, PSC_Daemon_run() will directly call the daemon main function without forking or handling a pidfile.
|
static |
Initialize to default values.
Resets all run options to their default values. If this isn't explicitly called, options are automatically initialized without a pidfile.
pidfile | the pidfile to use, or NULL for none |
|
static |
Don't wait for successful service startup.
When this is set, the parent process will exit immediately instead of waiting for PSC_Daemon_launched() to be called.
|
static |
Run as a different user.
When a different user is set here, an attempt is made to switch to it during service startup. This will only work when the service was launched by the superuser (root).
uid | user-id to switch to, or -1 for no change |
gid | group-id to switch to, or -1 for no change |