|
|
@ -124,6 +124,7 @@ static void launch_process(proc_instance_t *pi) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pid_t pid; |
|
|
|
pid_t pid; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
create_process_unixsock(pi); |
|
|
|
pid = fork(); |
|
|
|
pid = fork(); |
|
|
|
if (pid < 0) |
|
|
|
if (pid < 0) |
|
|
|
quit(1, "Failed to fork %s in launch_process", pi->processname); |
|
|
|
quit(1, "Failed to fork %s in launch_process", pi->processname); |
|
|
@ -132,7 +133,6 @@ static void launch_process(proc_instance_t *pi) |
|
|
|
|
|
|
|
|
|
|
|
rename_proc(pi->processname); |
|
|
|
rename_proc(pi->processname); |
|
|
|
write_namepid(pi); |
|
|
|
write_namepid(pi); |
|
|
|
create_process_unixsock(pi); |
|
|
|
|
|
|
|
ret = pi->process(pi); |
|
|
|
ret = pi->process(pi); |
|
|
|
close_unix_socket(pi->us.sockd, pi->us.path); |
|
|
|
close_unix_socket(pi->us.sockd, pi->us.path); |
|
|
|
rm_namepid(pi); |
|
|
|
rm_namepid(pi); |
|
|
@ -194,6 +194,20 @@ static void parse_config(ckpool_t *ckp) |
|
|
|
json_decref(json_conf); |
|
|
|
json_decref(json_conf); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void test_functions(ckpool_t *ckp) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
char *path = ckp->generator.us.path; |
|
|
|
|
|
|
|
int genfd; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
genfd = open_unix_client(ckp->generator.us.path); |
|
|
|
|
|
|
|
if (genfd < 0) { |
|
|
|
|
|
|
|
LOGWARNING("Failed to open generator socket %s", path); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
send_unix_msg(genfd, "shutdown"); |
|
|
|
|
|
|
|
close(genfd); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv) |
|
|
|
int main(int argc, char **argv) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct sigaction handler; |
|
|
|
struct sigaction handler; |
|
|
@ -261,6 +275,8 @@ int main(int argc, char **argv) |
|
|
|
sigaction(SIGTERM, &handler, NULL); |
|
|
|
sigaction(SIGTERM, &handler, NULL); |
|
|
|
sigaction(SIGINT, &handler, NULL); |
|
|
|
sigaction(SIGINT, &handler, NULL); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_functions(&ckp); |
|
|
|
|
|
|
|
|
|
|
|
/* Shutdown from here */ |
|
|
|
/* Shutdown from here */ |
|
|
|
join_pthread(pth_listener); |
|
|
|
join_pthread(pth_listener); |
|
|
|
|
|
|
|
|
|
|
|