source: users/devans/GNOME-3/stable/dports/gnome/gdm/files/patch-daemon.diff @ 118155

Last change on this file since 118155 was 118155, checked in by devans@…, 6 years ago

GNOME-3/stable: copy/merge unstable ports to stable in preparation for 3.12 stable release.

File size: 4.8 KB
  • gdm-server.c

    diff -ur daemon.orig/gdm-server.c daemon/gdm-server.c
    old new  
    9494        char    *auth_file;
    9595
    9696        guint    child_watch_id;
     97        guint    sigusr1_id;
    9798
    9899        gboolean is_initial;
    99100};
     
    179180        return g_strdup (server->priv->display_device);
    180181}
    181182
    182 static void
    183 gdm_server_ready (GdmServer *server)
    184 {
    185         g_debug ("GdmServer: Got USR1 from X server - emitting READY");
    186         g_signal_emit (server, signals[READY], 0);
    187 }
    188 
    189 static GSList *active_servers;
    190 static gboolean sigusr1_thread_running;
    191 static GCond sigusr1_thread_cond;
    192 static GMutex sigusr1_thread_mutex;
    193 
    194183static gboolean
    195 got_sigusr1 (gpointer user_data)
    196 {
    197         GPid pid = GPOINTER_TO_UINT (user_data);
    198         GSList *l;
    199 
    200         g_debug ("GdmServer: got SIGUSR1 from PID %d", pid);
    201 
    202         for (l = active_servers; l; l = l->next) {
    203                 GdmServer *server = l->data;
    204 
    205                 if (server->priv->pid == pid)
    206                         gdm_server_ready (server);
    207         }
    208 
    209         return G_SOURCE_REMOVE;
    210 }
    211 
    212 static gpointer
    213 sigusr1_thread_main (gpointer user_data)
    214 {
    215         sigset_t sigusr1_mask;
    216 
    217         /* Handle only SIGUSR1 */
    218         sigemptyset (&sigusr1_mask);
    219         sigaddset (&sigusr1_mask, SIGUSR1);
    220         sigprocmask (SIG_SETMASK, &sigusr1_mask, NULL);
     184on_sigusr1 (gpointer user_data)
    221185
    222         g_mutex_lock (&sigusr1_thread_mutex);
    223         sigusr1_thread_running = TRUE;
    224         g_cond_signal (&sigusr1_thread_cond);
    225         g_mutex_unlock (&sigusr1_thread_mutex);
    226 
    227         /* Spin waiting for a SIGUSR1 */
    228         while (TRUE) {
    229                 siginfo_t info;
    230 
    231                 if (sigwaitinfo (&sigusr1_mask, &info) == -1)
    232                         continue;
    233 
    234                 g_idle_add (got_sigusr1, GUINT_TO_POINTER (info.si_pid));
    235         }
    236 
    237         return NULL;
    238 }
    239 
    240 static void
    241 gdm_server_launch_sigusr1_thread_if_needed (void)
    242186{
    243         static GThread *sigusr1_thread;
     187        GdmServer *server = user_data;
    244188
    245         if (sigusr1_thread == NULL) {
    246                 sigusr1_thread = g_thread_new ("gdm SIGUSR1 catcher", sigusr1_thread_main, NULL);
     189        g_debug ("GdmServer: Got USR1 from X server - emitting READY");
    247190
    248                 g_mutex_lock (&sigusr1_thread_mutex);
    249                 while (!sigusr1_thread_running)
    250                         g_cond_wait (&sigusr1_thread_cond, &sigusr1_thread_mutex);
    251                 g_mutex_unlock (&sigusr1_thread_mutex);
    252         }
     191        g_signal_emit (server, signals[READY], 0);
     192        return FALSE;
    253193}
    254194
    255195/* We keep a connection (parent_dsp) open with the parent X server
     
    736676                g_signal_emit (server, signals [DIED], 0, num);
    737677        }
    738678
    739         active_servers = g_slist_remove (active_servers, server);
    740 
    741679        g_spawn_close_pid (server->priv->pid);
    742680        server->priv->pid = -1;
    743681
     
    781719        g_debug ("GdmServer: Starting X server process: %s", freeme);
    782720        g_free (freeme);
    783721
    784         active_servers = g_slist_append (active_servers, server);
    785 
    786         gdm_server_launch_sigusr1_thread_if_needed ();
    787 
    788722        if (!g_spawn_async_with_pipes (NULL,
    789723                                       argv,
    790724                                       (char **)env->pdata,
     
    11291063static void
    11301064gdm_server_init (GdmServer *server)
    11311065{
     1066
    11321067        server->priv = GDM_SERVER_GET_PRIVATE (server);
    11331068
    11341069        server->priv->pid = -1;
    11351070
    11361071        server->priv->log_dir = g_strdup (LOGDIR);
     1072
     1073        server->priv->sigusr1_id = g_unix_signal_add (SIGUSR1,
     1074                                                      on_sigusr1,
     1075                                                      server);
    11371076}
    11381077
    11391078static void
     
    11481087
    11491088        g_return_if_fail (server->priv != NULL);
    11501089
     1090        if (server->priv->sigusr1_id > 0)
     1091                g_source_remove (server->priv->sigusr1_id);
     1092
    11511093        gdm_server_stop (server);
    11521094
    11531095        g_free (server->priv->command);
  • main.c

    diff -ur daemon.orig/main.c daemon/main.c
    old new  
    295295        return debug;
    296296}
    297297
    298 /* SIGUSR1 is used by the X server to tell us that we're ready, so
    299  * block it. We'll unblock it in the worker thread in gdm-server.c
    300  */
    301 static void
    302 block_sigusr1 (void)
    303 {
    304         sigset_t mask;
    305 
    306         sigemptyset (&mask);
    307         sigaddset (&mask, SIGUSR1);
    308         sigprocmask (SIG_BLOCK, &mask, NULL);
    309 }
    310 
    311298int
    312299main (int    argc,
    313300      char **argv)
     
    328315                { NULL }
    329316        };
    330317
    331         block_sigusr1 ();
    332 
    333318        bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
    334319        textdomain (GETTEXT_PACKAGE);
    335320        setlocale (LC_ALL, "");
Note: See TracBrowser for help on using the repository browser.