summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Cameron <brian.cameron@sun.com>2008-09-29 20:43:32 +0000
committerBrian Cameron <bcameron@src.gnome.org>2008-09-29 20:43:32 +0000
commit346d5fad54d2471196fbeaaecb673043faecb14f (patch)
tree4cf986043c1763b032d1108be5e5db481e866e1b
parent4bf9f3dade6b70b21210d2c415fd8f2eb1f42de8 (diff)
downloadgdm-346d5fad54d2471196fbeaaecb673043faecb14f.tar.gz
Update the code which launches fbconsole so that fbconsole is killed after
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. svn path=/branches/gnome-2-20/; revision=6552
-rw-r--r--ChangeLog7
-rw-r--r--daemon/display.h1
-rw-r--r--daemon/server.c112
-rw-r--r--daemon/server.h1
4 files changed, 22 insertions, 99 deletions
diff --git a/ChangeLog b/ChangeLog
index 8162a9f9..29cf90d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2008-09-17 Brian Cameron <brian.cameron@sun.com>
* config/Xsession.solaris: Use bourne-shell syntax for setting
diff --git a/daemon/display.h b/daemon/display.h
index 7669fae2..defb376c 100644
--- a/daemon/display.h
+++ b/daemon/display.h
@@ -126,6 +126,7 @@ struct _GdmDisplay
pid_t slavepid;
pid_t greetpid;
pid_t sesspid;
+ pid_t fbconsolepid;
int last_sess_status; /* status returned by last session */
/* Notification connection */
diff --git a/daemon/server.c b/daemon/server.c
index 0e40187c..bd042235 100644
--- a/daemon/server.c
+++ b/daemon/server.c
@@ -137,7 +137,6 @@ jumpback_xioerror_handler (Display *disp)
static void
gdm_exec_fbconsole (GdmDisplay *disp)
{
- pid_t pid;
char *argv[6];
argv[0] = FBCONSOLE;
@@ -148,113 +147,19 @@ gdm_exec_fbconsole (GdmDisplay *disp)
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_stop (GdmDisplay *disp)
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 @@ gdm_server_start (GdmDisplay *disp,
d = disp;
+#ifdef HAVE_FBCONSOLE
+ d->fbconsolepid = 0;
+#endif
+
/* if an X server exists, wipe it */
gdm_server_stop (d);
diff --git a/daemon/server.h b/daemon/server.h
index 3e74ae0d..f54bf98b 100644
--- a/daemon/server.h
+++ b/daemon/server.h
@@ -56,7 +56,6 @@ gboolean gdm_server_start (GdmDisplay *d,
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);