Handle a SIGTERM in band.
**************************************************************************** */
-static void terminate(void)
+static void terminate(struct messaging_context *msg)
{
DEBUG(0,("Got SIGTERM: going down...\n"));
kill_async_dns_child();
gencache_stabilize();
- serverid_deregister(procid_self());
+ serverid_deregister(messaging_server_id(msg));
pidfile_unlink();
void *siginfo,
void *private_data)
{
- terminate();
+ struct messaging_context *msg = talloc_get_type_abort(
+ private_data, struct messaging_context);
+
+ terminate(msg);
}
-static bool nmbd_setup_sig_term_handler(void)
+static bool nmbd_setup_sig_term_handler(struct messaging_context *msg)
{
struct tevent_signal *se;
nmbd_event_context(),
SIGTERM, 0,
nmbd_sig_term_handler,
- NULL);
+ msg);
if (!se) {
DEBUG(0,("failed to setup SIGTERM handler"));
return false;
struct server_id server_id,
DATA_BLOB *data)
{
- terminate();
+ terminate(msg);
}
/**************************************************************************** **
exit(1);
}
- if (!nmbd_setup_sig_term_handler())
+ if (!nmbd_setup_sig_term_handler(nmbd_messaging_context()))
exit(1);
if (!nmbd_setup_sig_hup_handler())
exit(1);