xinit under A/UX

X Windows x at springer.Apple.COM
Tue Oct 9 09:55:27 AEST 1990


The following will be contributed to MIT for a future X release.


springer.x 15% rlog xinit.c

RCS file:        RCS/xinit.c,v;   Working file:    xinit.c
head:            1.2
locks:           ;  strict
access list:     x  
total revisions: 2;    selected revisions: 2
description:
----------------------------
revision 1.2
date: 90/08/09 17:35:27;  author: x;  state: Exp;  lines added/del: 45/0
Make XmacII the default server.
Close window of vulnerability to death-dealing signals, ensure forks
have returned useable process ids before enabling SigCatch.
Handle SIGUSR1 correctly.
For backward compatability, don't require initial slash or . on program names.
SCP
----------------------------
revision 1.1
date: 90/05/29 14:02:52;  author: x;  state: Exp;
Initial revision
=============================================================================
springer.x 16% rcsdiff -c -r1.1 xinit.c
RCS file: RCS/xinit.c,v
retrieving revision 1.1
diff -c -r1.1 xinit.c
*** /tmp/,RCSt1a01184   Mon Oct  8 16:42:15 1990
--- xinit.c     Thu Aug  9 17:37:58 1990
***************
*** 81,87 ****
--- 81,91 ----
  char displayname[100] = "unix";
  char client_display[100];

+ #ifdef macII
+ char *default_server = "XmacII";
+ #else
  char *default_server = "X";
+ #endif
  char *default_display = ":0";         /* choose most efficient */
  char *default_client[] = {"xterm", "-geometry", "+1+1", "-n", "login",
"-displ
ay", NULL};
  char *serverargv[100];
***************
*** 120,129 ****
--- 124,145 ----
  #endif
  }

+ #ifdef macII
+ /*
+  * Under A/UX the server appears to execute far enough to send
SIGUSR1
+  * BEFORE this xinit parent process returns from forking. When xinit
+  * finally gets to pause(), SIGUSR1 is history. So we keep some state
...
+  */
+ int sigUsr1seen = 0;
+ #endif
+
  void
  sigUsr1(sig)
        int sig;
  {
+ #ifdef macII
+       sigUsr1seen = 1;
+ #endif
  #ifdef SYSV
        signal (sig, sigUsr1);
  #endif
***************
*** 163,169 ****
--- 179,189 ----
         * copy the client args.
         */
        if (argc == 0 ||
+ #ifdef macII
+           (**argv != '/' && **argv != '.' && !isalpha(**argv))) {
+ #else
            (**argv != '/' && **argv != '.')) {
+ #endif
                for (ptr = default_client; *ptr; )
                        *cptr++ = *ptr++;
                strcpy(client_display, displayname);
***************
*** 197,203 ****
--- 217,227 ----
         * Copy the server args.
         */
        if (argc == 0 ||
+ #ifdef macII
+           (**argv != '/' && **argv != '.' && !isalpha(**argv))) {
+ #else
            (**argv != '/' && **argv != '.')) {
+ #endif
                *sptr++ = default_server;
        } else {
                server_given = 1;
***************
*** 282,295 ****
--- 306,332 ----
        /*
         * Start the server and client.
         */
+ #ifdef macII
+       signal(SIGQUIT, SIG_IGN);
+       signal(SIGINT, SIG_IGN);
+       signal(SIGHUP, SIG_IGN);
+       signal(SIGPIPE, SIG_IGN);
+ #else
        signal(SIGQUIT, sigCatch);
        signal(SIGINT, sigCatch);
        signal(SIGHUP, sigCatch);
        signal(SIGPIPE, sigCatch);
+ #endif
        signal(SIGALRM, sigAlarm);
        signal(SIGUSR1, sigUsr1);
        if ((serverpid = startServer(server)) > 0
         && (clientpid = startClient(client)) > 0) {
+ #ifdef macII
+               signal(SIGQUIT, sigCatch);
+               signal(SIGINT, sigCatch);
+               signal(SIGHUP, sigCatch);
+               signal(SIGPIPE, sigCatch);
+ #endif
                pid = -1;
                while (pid != clientpid && pid != serverpid)
                        pid = wait(NULL);
***************
*** 446,454 ****
--- 483,499 ----
                 * If your machine is substantially slower than 15
seconds,
                 * you can easily adjust this value.
                 */
+ #ifdef macII
+               if (!sigUsr1seen) {
+                   alarm (15);
+                   pause ();
+                   alarm (0);
+               }
+ #else
                alarm (15);
                pause ();
                alarm (0);
+ #endif

                if (waitforserver(serverpid) == 0) {
                        Error("unable to connect to X server\r\n");



More information about the Comp.unix.aux mailing list