[gdm/multi-stack-async-stop: 34/37] Don't tie unix signals to event loop in worker



commit 0f9656ac2dcb0e0b42223012e01fbd919d6eb3ef
Author: Ray Strode <rstrode redhat com>
Date:   Wed Apr 22 17:57:11 2009 -0400

    Don't tie unix signals to event loop in worker
    
    One common bit of boilerplate we use in the various parts of GDM is the
    gdm_signal_handler* functions.  They handle bridging asynchronous unix
    signals to the glib main loop so they can be processes safely.
    
    It doesn't make sense to use those functions in the worker, though.
    Often the worker will be blocking in a PAM module instead of the glib
    main loop, so deferring signal handling until the main loop iterates,
    may be deferring signal handling indefinitely.
    
    This is especially bad for the worker, since the slave sends a TERM
    signal to the greeter to terminate the PAM conversation.  The above code
    meant that some conversations were never getting terminated.

 daemon/session-worker-main.c |   86 ------------------------------------------
 1 files changed, 0 insertions(+), 86 deletions(-)
---
diff --git a/daemon/session-worker-main.c b/daemon/session-worker-main.c
index 6709cbe..f1edf25 100644
--- a/daemon/session-worker-main.c
+++ b/daemon/session-worker-main.c
@@ -28,7 +28,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <signal.h>
 #include <locale.h>
 
 #include <glib.h>
@@ -39,7 +38,6 @@
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
-#include "gdm-signal-handler.h"
 #include "gdm-common.h"
 #include "gdm-log.h"
 #include "gdm-session-worker.h"
@@ -48,71 +46,6 @@
 #define SERVER_DBUS_INTERFACE "org.gnome.DisplayManager.SessionServer"
 
 static gboolean
-signal_cb (int      signo,
-           gpointer data)
-{
-        int ret;
-
-        g_debug ("Got callback for signal %d", signo);
-
-        ret = TRUE;
-
-        switch (signo) {
-        case SIGSEGV:
-        case SIGBUS:
-        case SIGILL:
-        case SIGABRT:
-                g_debug ("Caught signal %d.", signo);
-
-                ret = FALSE;
-                break;
-
-        case SIGFPE:
-        case SIGPIPE:
-                /* let the fatal signals interrupt us */
-                g_debug ("Caught signal %d, shutting down abnormally.", signo);
-                ret = FALSE;
-
-                break;
-
-        case SIGINT:
-        case SIGTERM:
-                /* let the fatal signals interrupt us */
-                g_debug ("Caught signal %d, shutting down normally.", signo);
-                ret = FALSE;
-                break;
-
-        case SIGHUP:
-                g_debug ("Got HUP signal");
-                /* FIXME:
-                 * Reread config stuff like system config files, VPN service files, etc
-                 */
-                ret = TRUE;
-
-                break;
-
-        case SIGUSR1:
-                g_debug ("Got USR1 signal");
-                /* FIXME:
-                 * Play with log levels or something
-                 */
-                ret = TRUE;
-
-                gdm_log_toggle_debug ();
-
-                break;
-
-        default:
-                g_debug ("Caught unhandled signal %d", signo);
-                ret = TRUE;
-
-                break;
-        }
-
-        return ret;
-}
-
-static gboolean
 is_debug_set (gboolean arg)
 {
         /* enable debugging for unstable builds */
@@ -130,7 +63,6 @@ main (int    argc,
         GMainLoop        *main_loop;
         GOptionContext   *context;
         GdmSessionWorker *worker;
-        GdmSignalHandler *signal_handler;
         const char       *address;
         static gboolean   debug      = FALSE;
         static GOptionEntry entries []   = {
@@ -165,30 +97,12 @@ main (int    argc,
 
         main_loop = g_main_loop_new (NULL, FALSE);
 
-        signal_handler = gdm_signal_handler_new ();
-        gdm_signal_handler_set_fatal_func (signal_handler,
-                                           (GDestroyNotify)g_main_loop_quit,
-                                           main_loop);
-        gdm_signal_handler_add (signal_handler, SIGTERM, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGINT, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGILL, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGBUS, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGFPE, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGHUP, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGSEGV, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGABRT, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGUSR1, signal_cb, NULL);
-
         g_main_loop_run (main_loop);
 
         if (worker != NULL) {
                 g_object_unref (worker);
         }
 
-        if (signal_handler != NULL) {
-                g_object_unref (signal_handler);
-        }
-
         g_main_loop_unref (main_loop);
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]