#include <signal.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <fcntl.h>
#include <yaz/daemon.h>
#include <yaz/log.h>
#include <yaz/snprintf.h>
Go to the source code of this file.
Functions | |
| int | yaz_daemon (const char *progname, unsigned int flags, void(*work)(void *data), void *data, const char *pidfile, const char *uid) |
| daemon utility. | |
Definition in file daemon.c.
| int yaz_daemon | ( | const char * | progname, | |
| unsigned int | flags, | |||
| void(*)(void *data) | work, | |||
| void * | data, | |||
| const char * | pidfile, | |||
| const char * | uid | |||
| ) |
daemon utility.
| progname | program name for logging purposes. | |
| flags | flags which is a bit-wise combination of YAZ_DAEMON_.. | |
| work | working handler (which may be running in different process) | |
| data | opaque data to be passed to work handler | |
| pidfile | filename with Process-ID (NULL for no file) | |
| uid | effective user ID for handler (NULL for no same as caller) |
Flag YAZ_DAEMON_FORK: Puts the service in the background on Unix.
Flag YAZ_DAEMON_DEBUG: Puts the service in debug mode (no fork at all).
Flag YAZ_DAEMON_KEEPALIVE: Repeatedly calls work handler if it makes a "fatal" error.
Definition at line 160 of file daemon.c.
References YAZ_DAEMON_DEBUG, YAZ_DAEMON_FORK, YAZ_DAEMON_KEEPALIVE, yaz_log(), YLOG_ERRNO, and YLOG_FATAL.
1.5.6