daeconfig.h File Reference

Airframe Daemon Configuration Support. More...

#include <airframe/autoinc.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

GOptionGroup * daec_option_group ()
 Return a GOptionGroup for daemon configuration.
gboolean daec_setup (GError **err)
 Set up daemon configuration.
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

#define DAEC_ERROR_SETUP   1
 

Daeconfig setup error.

Signifies that daemonization failed due to an underlying operating system error.


Function Documentation

gboolean daec_did_fork  ) 
 

Return forked state.

Returns true if a prior call to daec_setup() caused the application to fork to the background.

Returns:
TRUE if the daemon has forked, FALSE otherwise

gboolean daec_did_quit  ) 
 

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.

Returns:
TRUE if daec_quit() has been called.

gboolean daec_is_daemon  ) 
 

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.

Returns:
TRUE if in daemon mode, FALSE otherwise.

GOptionGroup* daec_option_group  ) 
 

Return a GOptionGroup for daemon configuration.

This GOptionGroup defines two options: --daemon (-d) to become a daemon, and --foreground to run in daemon mode without forking.

Returns:
a daeconfig GOptionGroup

gboolean daec_setup GError **  err  ) 
 

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.

Parameters:
err an error description
Returns:
TRUE on success, FALSE otherwise

gboolean daec_will_fork  ) 
 

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.

Returns:
TRUE if subsequent call to daec_setup() will fork, FALSE otherwise.


© 2005-2006 Carnegie Mellon University
Generated Thu Jun 15 10:08:41 2006 for Airframe 0.6.2 by Doxygen 1.4.5.