diff options
author | Simo Sorce <idra@samba.org> | 2010-06-16 13:03:32 -0400 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-03-29 16:03:50 +0200 |
commit | 0c130105f5b70803daf784bd9a3c86ed34295338 (patch) | |
tree | 256661eabc0f9fd6a95ba3fc25d4818c51bfb9d1 /source3/printing | |
parent | 0b7b8414ddb94ea05c633ec655493db4ffcad3cd (diff) | |
download | samba-0c130105f5b70803daf784bd9a3c86ed34295338.tar.gz samba-0c130105f5b70803daf784bd9a3c86ed34295338.tar.bz2 samba-0c130105f5b70803daf784bd9a3c86ed34295338.zip |
s3:spoolssd Add spoolss own signal handlers
Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/spoolssd.c | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c index 1668bd886d..a7b64c9e61 100644 --- a/source3/printing/spoolssd.c +++ b/source3/printing/spoolssd.c @@ -49,6 +49,57 @@ static void smb_conf_updated(struct messaging_context *msg, spoolss_reopen_logs(); } +static void spoolss_sig_term_handler(struct tevent_context *ev, + struct tevent_signal *se, + int signum, + int count, + void *siginfo, + void *private_data) +{ + exit_server_cleanly("termination signal"); +} + +static void spoolss_setup_sig_term_handler(void) +{ + struct tevent_signal *se; + + se = tevent_add_signal(server_event_context(), + server_event_context(), + SIGTERM, 0, + spoolss_sig_term_handler, + NULL); + if (!se) { + exit_server("failed to setup SIGTERM handler"); + } +} + +static void spoolss_sig_hup_handler(struct tevent_context *ev, + struct tevent_signal *se, + int signum, + int count, + void *siginfo, + void *private_data) +{ + change_to_root_user(); + DEBUG(1,("Reloading printers after SIGHUP\n")); + reload_printers(server_messaging_context()); + spoolss_reopen_logs(); +} + +static void spoolss_setup_sig_hup_handler(void) +{ + struct tevent_signal *se; + + se = tevent_add_signal(server_event_context(), + server_event_context(), + SIGHUP, 0, + spoolss_sig_hup_handler, + NULL); + if (!se) { + exit_server("failed to setup SIGHUP handler"); + } +} + void start_spoolssd(void) { pid_t pid; @@ -83,8 +134,8 @@ void start_spoolssd(void) spoolss_reopen_logs(); - smbd_setup_sig_term_handler(); - smbd_setup_sig_hup_handler(); + spoolss_setup_sig_term_handler(); + spoolss_setup_sig_hup_handler(); if (!serverid_register(procid_self(), FLAG_MSG_GENERAL|FLAG_MSG_SMBD |