#include "xdasd_main.h"
#include "xdasd_log.h"
#include "xdasd_cmdline.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#include <unistd.h>
Go to the source code of this file.
Functions | |
static int | xdasd_check_pid (const char *pidfile) |
Check a pid file to see if xdasd is already running. | |
static int | xdasd_write_pid (const char *pidfile, pid_t pid) |
Write a pid file. | |
static int | xdasd_daemonize (void) |
Convert this process to a console-detached daemon. | |
static void | xdasd_signal_handler (int signum) |
Handles all registered signals from the system. | |
static int | xdasd_setup_signal_handler (void) |
Configures signal handlers for the process. | |
int | main (int argc, char **argv) |
The main program entry point. |
Definition in file xdasd_unix.c.
int main | ( | int | argc, | |
char ** | argv | |||
) |
The main program entry point.
[in] | argc | - the number of arguments in argv . |
[in] | argv | - an array of argument string pointers. |
For internal use only.
Definition at line 197 of file xdasd_unix.c.
References XDASCmdLine_tag::detach, XDASCmdLine_tag::runpath, xdasd_check_pid(), xdasd_daemonize(), xdasd_fatal(), xdasd_main_init(), xdasd_main_run(), xdasd_parse_cmdline(), XDASD_PIDFNAME, xdasd_setup_signal_handler(), and xdasd_write_pid().
static int xdasd_check_pid | ( | const char * | pidfile | ) | [static] |
Check a pid file to see if xdasd is already running.
The pid file contains the PID of the process that is already running.
[in] | pidfile | - the name of a file to read. |
For internal use only.
Definition at line 66 of file xdasd_unix.c.
Referenced by main().
static int xdasd_daemonize | ( | void | ) | [static] |
Convert this process to a console-detached daemon.
Turn the calling process into a daemon (detach from tty setuid(), etc).
For internal use only.
Definition at line 114 of file xdasd_unix.c.
Referenced by main().
static int xdasd_setup_signal_handler | ( | void | ) | [static] |
Configures signal handlers for the process.
Configures the process to receive SIGALRM, SIGTERM, SIGHUP, SIGPIPE.
For internal use only.
Definition at line 166 of file xdasd_unix.c.
References xdasd_signal_handler().
Referenced by main().
static void xdasd_signal_handler | ( | int | signum | ) | [static] |
Handles all registered signals from the system.
Get in, get out - fast.
[in] | signum | - the signal number to handle. |
For internal use only.
Definition at line 148 of file xdasd_unix.c.
References xdasd_set_signal(), XDASD_SIGALRM, XDASD_SIGHUP, and XDASD_SIGTERM.
Referenced by xdasd_setup_signal_handler().
static int xdasd_write_pid | ( | const char * | pidfile, | |
pid_t | pid | |||
) | [static] |
Write a pid file.
[in] | pidfile | - the name of the file to write. |
[in] | pid | - the PID value to write to pidfile . |
For internal use only.
Definition at line 93 of file xdasd_unix.c.
Referenced by main().