Go to the source code of this file.
Defines | |
#define | STR(s) #s |
Defines utility functions used by other modules. | |
#define | XSTR(s) STR(s) |
Stringifies a preprocessor define. More... | |
#define | MAX_CMDEXEC_ARGS 32 |
Maximum number of arguments to executeCmd, not including neither the command name nor the trailing NULL. | |
Functions | |
char* | ip2str (u_int32 ip) |
Gets the string representation of a given IP address. More... | |
void | executeCmd (char *cmd,...) |
Executes a system command with the given parameters. More... | |
pid_t | daemonize () |
Make the current process a daemon. More... | |
void | setSignals (int *fShutdown) |
Catches SIGTERM and SIGINT. More... |
|
Maximum number of arguments to executeCmd, not including neither the command name nor the trailing NULL.
|
|
Defines utility functions used by other modules.
|
|
Stringifies a preprocessor define. Makes a string from a preprocessor define. Usage: cc -DBASEDIR=/usr source.C ------- source.C ---------- include "util.h" char* str = XSTR (BASEDIR); ------- end source.C ------
|
|
Make the current process a daemon. Forks off and closes all files.
|
|
Executes a system command with the given parameters. This function is just a wrapper arround fork/execv that forks and executes the given command. The full path to the command is <libexecdir>/wccpd/cmd. It will wait for the command to complete before it returns. The variable length char* parameter list must be NULL terminated, and must not exceed MAX_CMDEXEC_ARGS parameters (not including neither the command name nor the trailing NULL).
|
|
Gets the string representation of a given IP address. This function uses a statically allocated buffer, thus each call overwrites the previous call's result.
|
|
Catches SIGTERM and SIGINT. Each time one of the signals is received, the integer pointed to by fShutdown is incremented.
|