From fb65f7d6908d658b8d33b123324090279130de42 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Tue, 22 Jun 1999 17:27:58 +0000
Subject: [PATCH] Dump server objects on SIGHUP.

---
 server/select.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/server/select.c b/server/select.c
index 60a6fd42810..de0c6863407 100644
--- a/server/select.c
+++ b/server/select.c
@@ -150,6 +150,16 @@ static void handle_timeout( struct timeout_user *user )
     free( user );
 }
 
+#ifdef DEBUG_OBJECTS
+static int do_dump_objects;
+
+/* SIGHUP handler */
+static void sighup()
+{
+    do_dump_objects = 1;
+}
+#endif
+
 /* server main loop */
 void select_loop(void)
 {
@@ -157,6 +167,9 @@ void select_loop(void)
 
     setsid();
     signal( SIGPIPE, SIG_IGN );
+#ifdef DEBUG_OBJECTS
+    signal( SIGHUP, sighup );
+#endif
 
     while (nb_users)
     {
@@ -199,7 +212,14 @@ void select_loop(void)
 
         if (!ret) continue;
         if (ret == -1) {
-            if (errno == EINTR) continue;
+            if (errno == EINTR)
+            {
+#ifdef DEBUG_OBJECTS
+                if (do_dump_objects) dump_objects();
+                do_dump_objects = 0;
+#endif
+                continue;
+            }
             perror("select");
         }
 
-- 
GitLab