You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

9 years ago
/* Copyright 2016 Alex 'AdUser' Z (ad_user@runbox.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
9 years ago
#ifndef F2B_COMMON_H_
#define F2B_COMMON_H_
#include <assert.h>
9 years ago
#include <ctype.h>
#include <dlfcn.h>
9 years ago
#include <errno.h>
#include <fcntl.h>
9 years ago
#include <limits.h>
9 years ago
#include <stdarg.h>
9 years ago
#include <stdbool.h>
9 years ago
#include <stdint.h>
9 years ago
#include <stdio.h>
9 years ago
#include <stdlib.h>
#include <string.h>
#include <sys/file.h>
#include <sys/stat.h>
9 years ago
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
9 years ago
#include "strlcpy.h"
#define DEFAULT_PIDFILE_PATH "/var/run/f2b.pid"
#define DEFAULT_CSOCKET_PATH "/var/run/f2b.sock"
#define DEFAULT_CSOCKET_CPATH "/tmp/f2bc-sock-XXXXXX"
#define UNUSED(x) (void)(x)
#define SA_REGISTER(SIGNUM, HANDLER) \
memset(&act, 0x0, sizeof(act)); \
act.sa_handler = HANDLER; \
if (sigaction(SIGNUM, &act, NULL) != 0) { \
f2b_log_msg(log_error, "can't register handler for " #SIGNUM); \
return EXIT_FAILURE; \
}
9 years ago
#endif /* F2B_COMMON_H_ */