OSF DCE Application Development Guide--Introduction and Style Guide

OSF DCE Application Development Guide—Introduction and Style Guide
sigaddset(&signals, SIGTERM);
/* Set the current signal mask... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sigprocmask()"));
sigprocmask(SIG_BLOCK, &signals, NULL);
/* And now wait for the signals... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sigwait()..."));
while (1)
{
sig = sigwait(&signals);
switch (sig)
{
case SIGINT:
case SIGTERM:
/* SIGNAL-SPECIFIC ACTIONS GO HERE... */
break;
default:
continue;
}
break;
}
/* Unset the signal mask... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sigprocmask()"));
sigprocmask(SIG_UNBLOCK, &signals, NULL);
/* Terminate server: cause the main thread listen loop to return */
/* and go to cleanup. Obviously, if we’re not listening yet, this */
/* will fail... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling rpc_mgmt_stop_server_listening()"));
rpc_mgmt_stop_server_listening(NULL, &status);
if (status != error_status_ok)
{
print_server_error("rpc_mgmt_stop_server_listening()", status);
exit(1);
}
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug7,
"Exiting signal_handler()"));
}
/******
*
* sample_mgmt_auth -- Management authorization callback function.
*
* This is the routine that is implicitly called to test authorization
* whenever someone tries to use the mgmt interface to tinker with us
A 58 Tandem Computers Incorporated 124246