summaryrefslogtreecommitdiff
path: root/pfinet/main.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-06-24 20:33:50 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-06-24 20:33:50 +0000
commit9fc5bceeed0f35c20e94155d5ff4cbc63a91fdb1 (patch)
tree79ec34b4c0f065866baf4a742c6cd153d4d120ff /pfinet/main.c
parent202298cce2b9a5be84a523544f6dc665546e6a43 (diff)
(sighup_handle): New function.
(arrange_shutdown_notification): Register SIGHUP handler.
Diffstat (limited to 'pfinet/main.c')
-rw-r--r--pfinet/main.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/pfinet/main.c b/pfinet/main.c
index db9a3219..cb770e17 100644
--- a/pfinet/main.c
+++ b/pfinet/main.c
@@ -81,6 +81,24 @@ S_startup_dosync (mach_port_t handle)
return 0;
}
+int
+sighup_handle (int signo)
+{
+ error_t
+ do1 (void *port)
+ {
+ struct port_info *pi = port;
+ if (pi->class == socketport_class)
+ ports_destroy_right (pi);
+ return 0;
+ }
+ ports_bucket_iterate (pfinet_bucket, do1);
+ sleep (10);
+ signal (SIGHUP, SIG_DFL);
+ raise (SIGHUP);
+ return 0;
+}
+
void
arrange_shutdown_notification ()
{
@@ -91,6 +109,8 @@ arrange_shutdown_notification ()
shutdown_notify_class = ports_create_class (0, 0);
+ signal (SIGHUP, sighup_handler);
+
/* Arrange to get notified when the system goes down,
but if we fail for some reason, just silently give up. No big deal. */