daeconfig.h File Reference
Airframe Daemon Configuration Support. More...
#include <airframe/autoinc.h>
#include <airframe/airopt.h>
Go to the source code of this file.
Defines | |
#define | DAEC_ERROR_DOMAIN g_quark_from_string("airframeDaemonError") |
GError domain for daeconfig errors. | |
#define | DAEC_ERROR_SETUP 1 |
Daeconfig setup error. | |
Functions | |
gboolean | daec_setup (GError **err) |
Set up daemon configuration. | |
gboolean | daec_add_option_group (AirOptionCtx *aoctx) |
Add an option group for daemon configuration to the given optoin context. | |
gboolean | daec_is_daemon () |
Return daemon mode state. | |
gboolean | daec_will_fork () |
Return future fork state. | |
gboolean | daec_did_fork () |
Return forked state. | |
gboolean | daec_did_quit () |
Return quit flag state. | |
void | daec_quit () |
Set the quit flag. |
Detailed Description
Airframe Daemon Configuration Support.Supplies automatic daemonization and the command line option processing necessary to use it. Use this when your application can run as a daemon and you want to give your users control over whether it does via the command line.
Define Documentation
|
Daeconfig setup error. Signifies that daemonization failed due to an underlying operating system error. |
Function Documentation
|
Add an option group for daemon configuration to the given optoin context. This option group defines two options: --daemon (-d) to become a daemon, and --foreground to run in daemon mode without forking.
|
|
Return forked state. Returns true if a prior call to daec_setup() caused the application to fork to the background.
|
|
Return quit flag state. Returns FALSE until daec_quit() has been called, then returns TRUE. Provided as a convenience, so applications don't have to track their own quit flag.
|
|
Return daemon mode state. Returns true if --daemon was passed in on the command line, regardless of whether --foreground was also present. If an application's logic is different for daemon and non-daemon mode, the application should use this call to determine which mode to run in.
|
|
Set up daemon configuration. Call this after parsing an options context including a GOptionGroup returned from daec_option_group(). This sets up internal state used by the other daeconfig calls and daemonizes the application, if necessary.
|
|
Return future fork state. Returns true if --daemon and not --foreground. Use this call to determine whether a call to daec_setup() will cause the application for fork to the background. This is primarily designed for interoperation with logconfig, which must know whether daeconfig will fork without requiring said fork to occur before logging is set up.
|