gdm r6552 - in branches/gnome-2-20: . daemon



Author: bcameron
Date: Mon Sep 29 20:43:32 2008
New Revision: 6552
URL: http://svn.gnome.org/viewvc/gdm?rev=6552&view=rev

Log:
2008-09-29 Brian Cameron <brian cameron sun com>

        * daemon/display.h, daemon/server.c: Update the code which launches
          fbconsole so that fbconsole is killed after the display is done being
          used.  This only affects Solaris, which uses fbconsole.
        * daemon/server.[ch]: Remove unused gdm_server_reinit function.


Modified:
   branches/gnome-2-20/ChangeLog
   branches/gnome-2-20/daemon/display.h
   branches/gnome-2-20/daemon/server.c
   branches/gnome-2-20/daemon/server.h

Modified: branches/gnome-2-20/daemon/display.h
==============================================================================
--- branches/gnome-2-20/daemon/display.h	(original)
+++ branches/gnome-2-20/daemon/display.h	Mon Sep 29 20:43:32 2008
@@ -126,6 +126,7 @@
 	pid_t slavepid;
 	pid_t greetpid;
 	pid_t sesspid;
+	pid_t fbconsolepid;
 	int last_sess_status; /* status returned by last session */
 
 	/* Notification connection */

Modified: branches/gnome-2-20/daemon/server.c
==============================================================================
--- branches/gnome-2-20/daemon/server.c	(original)
+++ branches/gnome-2-20/daemon/server.c	Mon Sep 29 20:43:32 2008
@@ -137,7 +137,6 @@
 static void
 gdm_exec_fbconsole (GdmDisplay *disp)
 {
-        pid_t pid;
         char *argv[6];
 
         argv[0] = FBCONSOLE;
@@ -148,113 +147,19 @@
 
 	gdm_debug ("Forking fbconsole");
 
-        pid = fork ();
-        if (pid == 0) {
+        d->fbconsolepid = fork ();
+        if (d->fbconsolepid == 0) {
                 gdm_close_all_descriptors (0 /* from */, -1 /* except */, -1 /* except2 */)
 ;
                 VE_IGNORE_EINTR (execv (argv[0], argv));
         }
-        if (pid == -1) {
+        if (d->fbconsolepid == -1) {
                 gdm_error (_("Can not start fallback console"));
         }
 }
 #endif
 
 /**
- * gdm_server_reinit:
- * @disp: Pointer to a GdmDisplay structure
- *
- * Reinit the display, basically sends a HUP signal
- * but only if the display exists
- */
-
-gboolean
-gdm_server_reinit (GdmDisplay *disp)
-{
-	if (disp == NULL)
-		return FALSE;
-
-	if (disp->servpid <= 0) {
-		/* Kill our connection if one existed, likely to result
-		 * in some bizzaro error right now */
-		if (disp->dsp != NULL) {
-			XCloseDisplay (disp->dsp);
-			disp->dsp = NULL;
-		}
-		return FALSE;
-	}
-
-	gdm_debug ("gdm_server_reinit: Server for %s is about to be reinitialized!", disp->name);
-
-	if ( ! setup_server_wait (disp))
-		return FALSE;
-
-	d->servstat = SERVER_PENDING;
-
-	if (disp->dsp != NULL) {
-		/* static because of the Setjmp */
-		static int (*old_xerror_handler)(Display *, XErrorEvent *) = NULL;
-		static int (*old_xioerror_handler)(Display *) = NULL;
-
-		old_xerror_handler = NULL;
-		old_xioerror_handler = NULL;
-
-		/* Do note the interaction of this Setjmp and the signal
-	   	   handlers and the Setjmp in slave.c */
-
-		/* Long live Setjmp, DIE DIE DIE XSetIOErrorHandler */
-
-		if (Setjmp (reinitjmp) == 0)  {
-			/* come here and we'll whack the server and wait to get
-			   an xio error */
-			old_xerror_handler = XSetErrorHandler (ignore_xerror_handler);
-			old_xioerror_handler = XSetIOErrorHandler (jumpback_xioerror_handler);
-
-			/* Now whack the server with a SIGHUP */
-			gdm_sigchld_block_push ();
-			if (disp->servpid > 1)
-				kill (disp->servpid, SIGHUP);
-			else
-				d->servstat = SERVER_DEAD;
-			gdm_sigchld_block_pop ();
-
-			/* the server is dead, weird */
-			if (disp->dsp != NULL) {
-				XCloseDisplay (disp->dsp);
-				disp->dsp = NULL;
-			}
-		}
-		/* no more display */
-		disp->dsp = NULL;
-		XSetErrorHandler (old_xerror_handler);
-		XSetIOErrorHandler (old_xioerror_handler);
-	} else {
-		/* Now whack the server with a SIGHUP */
-		gdm_sigchld_block_push ();
-		if (disp->servpid > 1)
-			kill (disp->servpid, SIGHUP);
-		else
-			d->servstat = SERVER_DEAD;
-		gdm_sigchld_block_pop ();
-	}
-
-	/* Wait for the SIGUSR1 */
-	do_server_wait (d);
-
-	if (d->servstat == SERVER_RUNNING) {
-#ifdef HAVE_FBCONSOLE
-		gdm_exec_fbconsole (d);
-#endif
-		return TRUE;
-        } else {
-		/* if something really REALLY screwed up, then whack the
-		   lockfiles for safety */
-		gdm_server_whack_lockfile (d);
-		return FALSE;
-	}
-}
-
-/**
  * gdm_server_stop:
  * @disp: Pointer to a GdmDisplay structure
  *
@@ -336,6 +241,13 @@
 
     gdm_server_wipe_cookies (disp);
 
+#ifdef HAVE_FBCONSOLE
+    /* Kill fbconsole if it is running */
+    if (d->fbconsolepid > 0)
+        kill (d->fbconsolepid, SIGTERM);
+    d->fbconsolepid = 0;
+#endif
+
     gdm_slave_whack_temp_auth_file ();
 }
 
@@ -732,6 +644,10 @@
 
     d = disp;
 
+#ifdef HAVE_FBCONSOLE
+    d->fbconsolepid = 0;
+#endif
+
     /* if an X server exists, wipe it */
     gdm_server_stop (d);
 

Modified: branches/gnome-2-20/daemon/server.h
==============================================================================
--- branches/gnome-2-20/daemon/server.h	(original)
+++ branches/gnome-2-20/daemon/server.h	Mon Sep 29 20:43:32 2008
@@ -56,7 +56,6 @@
 					 int min_flexi_disp,
 					 int flexi_retries);
 void		gdm_server_stop		(GdmDisplay *d);
-gboolean	gdm_server_reinit	(GdmDisplay *d);
 void		gdm_server_whack_clients (Display *dsp);
 void		gdm_server_checklog	(GdmDisplay *disp);
 



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