* Changed signal handling
* Moved clixon-proc sigchild handling from handler to clixon_events
This commit is contained in:
parent
dea3962cc0
commit
7762b10cbb
16 changed files with 268 additions and 126 deletions
|
|
@ -166,13 +166,8 @@ backend_sig_term(int arg)
|
|||
static void
|
||||
backend_sig_child(int arg)
|
||||
{
|
||||
int status;
|
||||
int pid;
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
if ((pid = waitpid(-1, &status, 0)) != -1 && WIFEXITED(status)){
|
||||
}
|
||||
clicon_sig_ignore_set(1);
|
||||
clicon_sig_child_set(1);
|
||||
}
|
||||
|
||||
/*! Create backend server socket and register callback
|
||||
|
|
@ -1038,7 +1033,7 @@ main(int argc,
|
|||
goto done;
|
||||
if (stream_timer_setup(0, h) < 0)
|
||||
goto done;
|
||||
if (clixon_event_loop() < 0)
|
||||
if (clixon_event_loop(h) < 0)
|
||||
goto done;
|
||||
ok:
|
||||
retval = 0;
|
||||
|
|
|
|||
|
|
@ -873,7 +873,7 @@ main(int argc,
|
|||
if (clixon_event_reg_timeout(t, timeout_fn, NULL, "timeout") < 0)
|
||||
goto done;
|
||||
}
|
||||
if (clixon_event_loop() < 0)
|
||||
if (clixon_event_loop(h) < 0)
|
||||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ restconf_terminate(clicon_handle h)
|
|||
xpath_optimize_exit();
|
||||
restconf_handle_exit(h);
|
||||
clicon_log_exit();
|
||||
clicon_debug(1, "%s done", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,17 +160,6 @@ restconf_sig_term(int arg)
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
static void
|
||||
restconf_sig_child(int arg)
|
||||
{
|
||||
int status;
|
||||
int pid;
|
||||
|
||||
if ((pid = waitpid(-1, &status, 0)) != -1 && WIFEXITED(status)){
|
||||
}
|
||||
clicon_sig_ignore_set(1);
|
||||
}
|
||||
|
||||
static char*
|
||||
evhtp_method2str(enum htp_method m)
|
||||
{
|
||||
|
|
@ -1286,11 +1275,6 @@ main(int argc,
|
|||
clicon_err(OE_DAEMON, errno, "Setting signal");
|
||||
goto done;
|
||||
}
|
||||
if (set_signal(SIGCHLD, restconf_sig_child, NULL) < 0){
|
||||
clicon_err(OE_DAEMON, errno, "Setting signal");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Find and read configfile */
|
||||
if (clicon_options_main(h) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@
|
|||
#include <pwd.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <libgen.h>
|
||||
|
|
@ -146,9 +145,13 @@ restconf_sig_term(int arg)
|
|||
restconf_terminate(_CLICON_HANDLE);
|
||||
}
|
||||
clicon_exit_set(); /* checked in clixon_event_loop() */
|
||||
clicon_debug(1, "%s done", __FUNCTION__);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/*! Reap stream child
|
||||
* XXX The -1 should be changed to proper pid, see eg clixon_process_waitpid
|
||||
*/
|
||||
static void
|
||||
restconf_sig_child(int arg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ api_stream(clicon_handle h,
|
|||
/* Poll upstream errors */
|
||||
stream_timeout(0, req);
|
||||
/* Start loop */
|
||||
clixon_event_loop();
|
||||
clixon_event_loop(h);
|
||||
close(s);
|
||||
clixon_event_unreg_fd(s, restconf_stream_cb);
|
||||
clixon_event_unreg_fd(rfcgi->listen_sock,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue