#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <signal.h>
#include <getopt.h>
#include <syslog.h>
#include "utils.h"
#include "ahm.h"
#include "watchdog.h"
Functions | |
void | get_command_line_options (int a_argc, char *a_argv[]) |
int | check_file_mode (const char *a_fname) |
int | check_file_owner (const char *a_fname, uid_t a_uid, gid_t a_gid) |
int | check_file_owner_mode (const char *a_fname, uid_t a_uid, gid_t a_gid) |
void | key_destroy_func (gpointer a_data) |
void | value_destroy_func (gpointer a_data) |
int | open_fifo (registration_info **a_reginfo) |
int | file_exists (const char *a_filename) |
int | read_registration_file (const char *a_filename, registration_info **a_reginfo) |
void | log_message (int a_event, int a_severity, unsigned int a_flags, const char *a_format,...) |
void | display_registration_info (const registration_info *a_reginfo) |
|
Checks the file to see if its mode is 0600.
|
|
Determines if the file provided, is owned by the uid and of the gid provided.
|
|
Checks the file to see if its mode is 0600 and has the uid and gid as indicated.
|
|
This is a debugging function to display the contents of the registration structure. |
|
Checks if a file exists.
|
|
This function parses the command line for specific options. The available options are: --non-daemon: allows the running the application monitor as an application with standard out directed to the terminal --enable-watchdog: enables opening the watchdog device and updating it. --watchdog-period[=value]: Sets the period between reseting the watchdog timer (in seconds). This is not useful unless used with --enable-watchdog. --register-period[=value]: Sets the period to check for registrations (in milliseconds) --registration-dir[=value]: Indicates where it should look for registrations Changing the registration directory and/or the registration period in the daemon will not cause the library code to be updated. Any clients must be separately configured to use the new registration directory and period, independent of the library. However, the library is not required by a client application. The client may opt to register without using the client library. |
|
Frees memory allocated for a hash key.
|
|
Logs a message to either the POSIX event log or syslog depending if POSIX_EVENT_LOGGING is defined. The only parameters used for logging using syslog are the a_severity and a_format (and its args).
|
|
Opens the heartbeat fifo and sets the value of the m_hbfd variable in the registration structure to that of the fifo's open file descriptor.
|
|
Opens the registration file and reads in its contents. The caller must provide a pointer whose memory is already allocated. If an application happens to be creating the registration file when the daemon is attempting to read it, it will most likely be treated by the daemon as an invalid file. However, it will be picked up by the next registration check. The following are messages that are logged for various registration file issues (where xxxx is a process identifier): "permissions on registration file are invalid for PID xxxxx" "script does not exist for PID xxxxx" "fifo does not exist for PID xxxxx"
|
|
Frees memory allocated for a hash value.
|