|
|
@ -15,7 +15,9 @@ |
|
|
|
#include <sys/stat.h> |
|
|
|
#include <sys/stat.h> |
|
|
|
#include <sys/types.h> |
|
|
|
#include <sys/types.h> |
|
|
|
#include <sys/wait.h> |
|
|
|
#include <sys/wait.h> |
|
|
|
|
|
|
|
#include <ctype.h> |
|
|
|
#include <fenv.h> |
|
|
|
#include <fenv.h> |
|
|
|
|
|
|
|
#include <getopt.h> |
|
|
|
#include <grp.h> |
|
|
|
#include <grp.h> |
|
|
|
#include <jansson.h> |
|
|
|
#include <jansson.h> |
|
|
|
#include <signal.h> |
|
|
|
#include <signal.h> |
|
|
@ -945,11 +947,25 @@ static void *watchdog(void *arg) |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static struct option long_options[] = { |
|
|
|
|
|
|
|
{"config", required_argument, 0, 'c'}, |
|
|
|
|
|
|
|
{"ckdb-name", required_argument, 0, 'd'}, |
|
|
|
|
|
|
|
{"group", required_argument, 0, 'g'}, |
|
|
|
|
|
|
|
{"help", no_argument, 0, 'h'}, |
|
|
|
|
|
|
|
{"killold", no_argument, 0, 'k'}, |
|
|
|
|
|
|
|
{"loglevel", required_argument, 0, 'l'}, |
|
|
|
|
|
|
|
{"name", required_argument, 0, 'n'}, |
|
|
|
|
|
|
|
{"proxy", no_argument, 0, 'p'}, |
|
|
|
|
|
|
|
{"ckdb-sockdir",required_argument, 0, 'S'}, |
|
|
|
|
|
|
|
{"sockdir", required_argument, 0, 's'}, |
|
|
|
|
|
|
|
{0, 0, 0, 0} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv) |
|
|
|
int main(int argc, char **argv) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct sigaction handler; |
|
|
|
struct sigaction handler; |
|
|
|
|
|
|
|
int c, ret, i = 0, j; |
|
|
|
char buf[512] = {}; |
|
|
|
char buf[512] = {}; |
|
|
|
int c, ret, i; |
|
|
|
|
|
|
|
ckpool_t ckp; |
|
|
|
ckpool_t ckp; |
|
|
|
|
|
|
|
|
|
|
|
/* Make significant floating point errors fatal to avoid subtle bugs being missed */ |
|
|
|
/* Make significant floating point errors fatal to avoid subtle bugs being missed */ |
|
|
@ -959,7 +975,7 @@ int main(int argc, char **argv) |
|
|
|
memset(&ckp, 0, sizeof(ckp)); |
|
|
|
memset(&ckp, 0, sizeof(ckp)); |
|
|
|
ckp.loglevel = LOG_NOTICE; |
|
|
|
ckp.loglevel = LOG_NOTICE; |
|
|
|
|
|
|
|
|
|
|
|
while ((c = getopt(argc, argv, "c:d:g:kl:n:pS:s:")) != -1) { |
|
|
|
while ((c = getopt_long(argc, argv, "c:d:g:hkl:n:pS:s:", long_options, &i)) != -1) { |
|
|
|
switch (c) { |
|
|
|
switch (c) { |
|
|
|
case 'c': |
|
|
|
case 'c': |
|
|
|
ckp.config = optarg; |
|
|
|
ckp.config = optarg; |
|
|
@ -970,6 +986,23 @@ int main(int argc, char **argv) |
|
|
|
case 'g': |
|
|
|
case 'g': |
|
|
|
ckp.grpnam = optarg; |
|
|
|
ckp.grpnam = optarg; |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'h': |
|
|
|
|
|
|
|
for (j = 0; long_options[j].val; j++) { |
|
|
|
|
|
|
|
struct option *jopt = &long_options[j]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (jopt->has_arg) { |
|
|
|
|
|
|
|
char *upper = alloca(strlen(jopt->name) + 1); |
|
|
|
|
|
|
|
int offset = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
|
|
|
|
upper[offset] = toupper(jopt->name[offset]); |
|
|
|
|
|
|
|
} while (upper[offset++] != '\0'); |
|
|
|
|
|
|
|
printf("-%c %s | --%s %s\n", jopt->val, |
|
|
|
|
|
|
|
upper, jopt->name, upper); |
|
|
|
|
|
|
|
} else |
|
|
|
|
|
|
|
printf("-%c | %s\n", jopt->val, jopt->name); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
exit(0); |
|
|
|
case 'k': |
|
|
|
case 'k': |
|
|
|
ckp.killold = true; |
|
|
|
ckp.killold = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|