patches/gdm-07-fbconsole.diff
changeset 14638 27ceb9334364
equal deleted inserted replaced
14637:3e5c618bf7e8 14638:27ceb9334364
       
     1 Index: daemon/display.h
       
     2 ===================================================================
       
     3 --- daemon/display.h	(revision 6551)
       
     4 +++ daemon/display.h	(working copy)
       
     5 @@ -126,6 +126,7 @@
       
     6  	pid_t slavepid;
       
     7  	pid_t greetpid;
       
     8  	pid_t sesspid;
       
     9 +	pid_t fbconsolepid;
       
    10  	int last_sess_status; /* status returned by last session */
       
    11  
       
    12  	/* Notification connection */
       
    13 Index: daemon/server.c
       
    14 ===================================================================
       
    15 --- daemon/server.c	(revision 6551)
       
    16 +++ daemon/server.c	(working copy)
       
    17 @@ -137,7 +137,6 @@
       
    18  static void
       
    19  gdm_exec_fbconsole (GdmDisplay *disp)
       
    20  {
       
    21 -        pid_t pid;
       
    22          char *argv[6];
       
    23  
       
    24          argv[0] = FBCONSOLE;
       
    25 @@ -148,113 +147,19 @@
       
    26  
       
    27  	gdm_debug ("Forking fbconsole");
       
    28  
       
    29 -        pid = fork ();
       
    30 -        if (pid == 0) {
       
    31 +        d->fbconsolepid = fork ();
       
    32 +        if (d->fbconsolepid == 0) {
       
    33                  gdm_close_all_descriptors (0 /* from */, -1 /* except */, -1 /* except2 */)
       
    34  ;
       
    35                  VE_IGNORE_EINTR (execv (argv[0], argv));
       
    36          }
       
    37 -        if (pid == -1) {
       
    38 +        if (d->fbconsolepid == -1) {
       
    39                  gdm_error (_("Can not start fallback console"));
       
    40          }
       
    41  }
       
    42  #endif
       
    43  
       
    44  /**
       
    45 - * gdm_server_reinit:
       
    46 - * @disp: Pointer to a GdmDisplay structure
       
    47 - *
       
    48 - * Reinit the display, basically sends a HUP signal
       
    49 - * but only if the display exists
       
    50 - */
       
    51 -
       
    52 -gboolean
       
    53 -gdm_server_reinit (GdmDisplay *disp)
       
    54 -{
       
    55 -	if (disp == NULL)
       
    56 -		return FALSE;
       
    57 -
       
    58 -	if (disp->servpid <= 0) {
       
    59 -		/* Kill our connection if one existed, likely to result
       
    60 -		 * in some bizzaro error right now */
       
    61 -		if (disp->dsp != NULL) {
       
    62 -			XCloseDisplay (disp->dsp);
       
    63 -			disp->dsp = NULL;
       
    64 -		}
       
    65 -		return FALSE;
       
    66 -	}
       
    67 -
       
    68 -	gdm_debug ("gdm_server_reinit: Server for %s is about to be reinitialized!", disp->name);
       
    69 -
       
    70 -	if ( ! setup_server_wait (disp))
       
    71 -		return FALSE;
       
    72 -
       
    73 -	d->servstat = SERVER_PENDING;
       
    74 -
       
    75 -	if (disp->dsp != NULL) {
       
    76 -		/* static because of the Setjmp */
       
    77 -		static int (*old_xerror_handler)(Display *, XErrorEvent *) = NULL;
       
    78 -		static int (*old_xioerror_handler)(Display *) = NULL;
       
    79 -
       
    80 -		old_xerror_handler = NULL;
       
    81 -		old_xioerror_handler = NULL;
       
    82 -
       
    83 -		/* Do note the interaction of this Setjmp and the signal
       
    84 -	   	   handlers and the Setjmp in slave.c */
       
    85 -
       
    86 -		/* Long live Setjmp, DIE DIE DIE XSetIOErrorHandler */
       
    87 -
       
    88 -		if (Setjmp (reinitjmp) == 0)  {
       
    89 -			/* come here and we'll whack the server and wait to get
       
    90 -			   an xio error */
       
    91 -			old_xerror_handler = XSetErrorHandler (ignore_xerror_handler);
       
    92 -			old_xioerror_handler = XSetIOErrorHandler (jumpback_xioerror_handler);
       
    93 -
       
    94 -			/* Now whack the server with a SIGHUP */
       
    95 -			gdm_sigchld_block_push ();
       
    96 -			if (disp->servpid > 1)
       
    97 -				kill (disp->servpid, SIGHUP);
       
    98 -			else
       
    99 -				d->servstat = SERVER_DEAD;
       
   100 -			gdm_sigchld_block_pop ();
       
   101 -
       
   102 -			/* the server is dead, weird */
       
   103 -			if (disp->dsp != NULL) {
       
   104 -				XCloseDisplay (disp->dsp);
       
   105 -				disp->dsp = NULL;
       
   106 -			}
       
   107 -		}
       
   108 -		/* no more display */
       
   109 -		disp->dsp = NULL;
       
   110 -		XSetErrorHandler (old_xerror_handler);
       
   111 -		XSetIOErrorHandler (old_xioerror_handler);
       
   112 -	} else {
       
   113 -		/* Now whack the server with a SIGHUP */
       
   114 -		gdm_sigchld_block_push ();
       
   115 -		if (disp->servpid > 1)
       
   116 -			kill (disp->servpid, SIGHUP);
       
   117 -		else
       
   118 -			d->servstat = SERVER_DEAD;
       
   119 -		gdm_sigchld_block_pop ();
       
   120 -	}
       
   121 -
       
   122 -	/* Wait for the SIGUSR1 */
       
   123 -	do_server_wait (d);
       
   124 -
       
   125 -	if (d->servstat == SERVER_RUNNING) {
       
   126 -#ifdef HAVE_FBCONSOLE
       
   127 -		gdm_exec_fbconsole (d);
       
   128 -#endif
       
   129 -		return TRUE;
       
   130 -        } else {
       
   131 -		/* if something really REALLY screwed up, then whack the
       
   132 -		   lockfiles for safety */
       
   133 -		gdm_server_whack_lockfile (d);
       
   134 -		return FALSE;
       
   135 -	}
       
   136 -}
       
   137 -
       
   138 -/**
       
   139   * gdm_server_stop:
       
   140   * @disp: Pointer to a GdmDisplay structure
       
   141   *
       
   142 @@ -336,6 +241,13 @@
       
   143  
       
   144      gdm_server_wipe_cookies (disp);
       
   145  
       
   146 +#ifdef HAVE_FBCONSOLE
       
   147 +    /* Kill fbconsole if it is running */
       
   148 +    if (d->fbconsolepid > 0)
       
   149 +        kill (d->fbconsolepid, SIGTERM);
       
   150 +    d->fbconsolepid = 0;
       
   151 +#endif
       
   152 +
       
   153      gdm_slave_whack_temp_auth_file ();
       
   154  }
       
   155  
       
   156 @@ -732,6 +644,10 @@
       
   157  
       
   158      d = disp;
       
   159  
       
   160 +#ifdef HAVE_FBCONSOLE
       
   161 +    d->fbconsolepid = 0;
       
   162 +#endif
       
   163 +
       
   164      /* if an X server exists, wipe it */
       
   165      gdm_server_stop (d);
       
   166  
       
   167 Index: daemon/server.h
       
   168 ===================================================================
       
   169 --- daemon/server.h	(revision 6551)
       
   170 +++ daemon/server.h	(working copy)
       
   171 @@ -56,7 +56,6 @@
       
   172  					 int min_flexi_disp,
       
   173  					 int flexi_retries);
       
   174  void		gdm_server_stop		(GdmDisplay *d);
       
   175 -gboolean	gdm_server_reinit	(GdmDisplay *d);
       
   176  void		gdm_server_whack_clients (Display *dsp);
       
   177  void		gdm_server_checklog	(GdmDisplay *disp);
       
   178