Contains functions common to most UBS daemons. This includes the version information, signal, and configuration defaults.
Included Files
- #include </usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/include/stdio.h>
- #include </usr/include/stdlib.h>
- #include </usr/include/string.h>
- #include </usr/include/time.h>
- #include </usr/include/signal.h>
- #include </usr/include/sys/types.h>
char PROCNAME[128]
struct tm* CUR_TIME
ubs_table GLOBAL
int LOGLEVEL
Sees if a UBS process is already running before starting.
int check_running ( void )
- int check_running
- Returns OK if not running, FAIL if the process is already started.
Copies default values into the global context.
void set_defaults ( void )
set_defaults Returns nothing.
The polling signal is used to see if the daemon is alive. Anyone can send a polling signal (currently defined as SIGURG (SIGUSR isn't defined on all unix platforms, and SIGUSR is pretty much unused, in case you were wondering.
void sig_poll ( int sig )
- int sig
- The number of the signal received
By default, the main UBS daemons bind a number of various quit common signals (SIGINT, SIGHUP, SIGQUIT, and so forth). This is where they go to die. Before the program exits (or crashes, as the case may be), it's nice to log it and such. This could probably be expanded to include more information for debugging in the future.
void sig_quit ( int sig )
- int sig
- The number of the signal received
Called by all UBS events and daemons upon initialization. This binds all the default signals, and copies default values into the GLOBAL configuration. Also records the process name and other good stuff. This should be called right after the GLOBAL table is initialized.
int ubs_init ( char* pname )
- int ubs_init
- Returns OK on success
- char* pname
- The program name, same as argv[0]
Displays a quick blurb about the program and the current version. The version number is declared in config.h, which is generated by autoconf.
void version ( void )