diff options
Diffstat (limited to 'source3/printing/queue_process.c')
-rw-r--r-- | source3/printing/queue_process.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c index 1b7b4f8579..20f1a5b06b 100644 --- a/source3/printing/queue_process.c +++ b/source3/printing/queue_process.c @@ -142,6 +142,35 @@ static void bq_setup_sig_hup_handler(struct tevent_context *ev, } } +static void bq_sig_chld_handler(struct tevent_context *ev_ctx, + struct tevent_signal *se, + int signum, int count, + void *siginfo, void *pvt) +{ + int status; + pid_t pid; + + pid = sys_waitpid(-1, &status, WNOHANG); + if (WIFEXITED(status)) { + DEBUG(6, ("Bq child process %d terminated with %d\n", + (int)pid, WEXITSTATUS(status))); + } else { + DEBUG(3, ("Bq child process %d terminated abnormally\n", + (int)pid)); + } +} + +static void bq_setup_sig_chld_handler(struct tevent_context *ev_ctx) +{ + struct tevent_signal *se; + + se = tevent_add_signal(ev_ctx, ev_ctx, SIGCHLD, 0, + bq_sig_chld_handler, NULL); + if (!se) { + exit_server("failed to setup SIGCHLD handler"); + } +} + static void bq_smb_conf_updated(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, @@ -235,14 +264,11 @@ pid_t start_background_queue(struct tevent_context *ev, bq_reopen_logs(logfile); bq_setup_sig_term_handler(); bq_setup_sig_hup_handler(ev, msg_ctx); + bq_setup_sig_chld_handler(ev); BlockSignals(false, SIGTERM); BlockSignals(false, SIGHUP); - if (!pcap_cache_loaded()) { - pcap_cache_reload(ev, msg_ctx, &reload_printers); - } - if (!printing_subsystem_queue_tasks(ev, msg_ctx)) { exit(1); } @@ -269,6 +295,8 @@ pid_t start_background_queue(struct tevent_context *ev, smb_panic("tevent_add_fd() failed for pause_pipe"); } + pcap_cache_reload(ev, msg_ctx, &reload_pcap_change_notify); + DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); ret = tevent_loop_wait(ev); /* should not be reached */ |