[comp.unix.aux] xinit under A/UX

coolidge@cs.uiuc.edu (John Coolidge) (10/05/90)

Has anyone out there had any luck getting xinit to do the right thing
under A/UX 2.0? I've been working with the xinit source off the MIT R4
tape, and it will start up the server fine but then hang. I've got it
traced back to the alarm(15) call in startServer(), but why it's just
hanging at that point I don't know. Does anyone know any magic to make
it work?

--John

rmtodd@servalan.uucp (Richard Todd) (10/05/90)

coolidge@cs.uiuc.edu (John Coolidge) writes:

>Has anyone out there had any luck getting xinit to do the right thing
>under A/UX 2.0? I've been working with the xinit source off the MIT R4
>tape, and it will start up the server fine but then hang. I've got it
>traced back to the alarm(15) call in startServer(), but why it's just
>hanging at that point I don't know. Does anyone know any magic to make
>it work?

  Well, I don't usually use xinit (I use xdm and xdmshell usually),
but I have used xinit under A/UX 2.0 and it works OK.  You do have to
be a bit careful in the args, etc. passed to it; I recall that the
default "X11" script that MIT recommended to start up xinit was
broken.  Here are the scripts I use to start up X11 in color or mono
mode with xinit.  (BTW, all this is using the stock X11R4 patchlevel
11 MIT source for server,clients,etc.)

#--------------------------------CUT HERE-------------------------------------
#! /bin/sh
#
# This is a shell archive.  Save this into a file, edit it
# and delete all lines above this comment.  Then give this
# file to sh by executing the command "sh file".  The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#
# -rwxr-xr-x   1 rmtodd   root         857 Oct  4 20:07 .x11start
# -rwxr-xr-x   1 rmtodd   root          92 Oct  4 20:05 colorX
# -rwxr-xr-x   1 rmtodd   root         236 Oct  4 20:08 monoX
#
echo 'x - .x11start'
if test -f .x11start; then echo 'shar: not overwriting .x11start'; else
sed 's/^X//' << '________This_Is_The_END________' > .x11start
X: "@(#) /usr/lib/X11/.x11start		Shell Script for X11"
X
Xif [ -r /dev/oldmsgs ]
Xthen
X      # Do a tail to display any new console messages in this window,
X      # using -1c to ensure that we don't see any old messages.  Start
X      # this at the beginning of this script so that we see any messages
X      # generated while this script executes.
X      tail -1cf /dev/oldmsgs &
X      tailproc=$!
Xfi
X
Xxstdcmap -all
Xxset m 4 2 s 120 120
Xxrdb -load /users/rmtodd/.Xresources
Xtwm &
Xsleep 3
X#xclock -analog -update 60 -geometry 96x96-2-2 &
X#sleep 1
Xxload -geometry 96x96-100-2 &
Xsleep 3
X#xlogo -fg grey -bg maroon -geometry 96x96-200-2 &
X#sleep 1
Xxterm  -geometry 80x24+40+88 -title "`hostname` 1" -bg black -fg cyan &
Xsleep 3
X#xterm -geometry 80x24+60+108 -title "`hostname` 2" &
X#sleep 1
X
Xif [ "$tailproc" ]
Xthen
X    $SHELL
X    kill $tailproc
Xelse
X	exec $SHELL
Xfi
________This_Is_The_END________
if test `wc -l < .x11start` -ne 35; then
	echo 'shar: .x11start was damaged during transit (should have been 35 bytes)'
fi
fi		; : end of overwriting check
echo 'x - colorX'
if test -f colorX; then echo 'shar: not overwriting colorX'; else
sed 's/^X//' << '________This_Is_The_END________' > colorX
X:
X# Go into X Windows in color mode
Xexec /bin/sh /users/rmtodd/bin/monoX -screen 0 -depth 8
________This_Is_The_END________
if test `wc -l < colorX` -ne 3; then
	echo 'shar: colorX was damaged during transit (should have been 3 bytes)'
fi
fi		; : end of overwriting check
echo 'x - monoX'
if test -f monoX; then echo 'shar: not overwriting monoX'; else
sed 's/^X//' << '________This_Is_The_END________' > monoX
X: "@(#) /usr/bin/X11/X11		Shell Script for X11"
XDISPLAY="unix:0.0"
Xexport DISPLAY
Xxinit /usr/bin/X11/xterm -geometry 60x8+0+0 +ut -sb -fb 6x10 -T "console" -e $HOME/.x11start -- -logo -v $* > $HOME/debug.log 2>&1
XXrepair
Xscreenrestore
X
________This_Is_The_END________
if test `wc -l < monoX` -ne 7; then
	echo 'shar: monoX was damaged during transit (should have been 7 bytes)'
fi
fi		; : end of overwriting check
exit 0

x@springer.Apple.COM (X Windows) (10/09/90)

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");

coolidge@cs.uiuc.edu (John Coolidge) (10/09/90)

Thanks to everybody who sent helpful messages. The root cause of
the problem, as you probably guessed, was my fault. I picked up
the BSD compatibility bug when building things and linked a bunch
of things with -lbsd. Unfortunately, some clients don't agree with
that: xinit and xterm being two. Xterm I figured out fast, but
xinit took a bit longer. I (and my new release of X11 w/shared
libraries) are now xinitting fine.

--John

--------------------------------------------------------------------------
John L. Coolidge     Internet:coolidge@cs.uiuc.edu   UUCP:uiucdcs!coolidge
Of course I don't speak for the U of I (or anyone else except myself)
Copyright 1990 John L. Coolidge. Copying allowed if (and only if) attributed.
You may redistribute this article if and only if your recipients may as well.

jordan@Morgan.COM (Jordan Hayes) (10/09/90)

Anonymous X Windows Dude (-ette?) <x@springer.Apple.COM> writes:

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

	[ ... ]

	Make XmacII the default server.

	[ ... ]

	diff -c -r1.1 xinit.c

	[ ... ]

	+ #ifdef macII
	+ char *default_server = "XmacII";
	+ #else
	  char *default_server = "X";
	+ #endif

Don't do this.  For all architectures, you should make a link from X<arch>
to X ... no need to put this code in there.

/jordan

seth@aic.dpl.scg.hac.com (Seth Goldman 317-5693) (10/10/90)

All of a sudden I can't run X as anyone other than
superuser.  Somehow I must have trashed the protection
on some file/device/directory.  My xinit/XmacII process
quits immediately reporting "killed.".  How do I fix this?

Thanks,
Seth Goldman
seth@aic.hrl.hac.com OR seth@cs.ucla.edu

coolidge@cs.uiuc.edu (John Coolidge) (10/10/90)

seth@aic.dpl.scg.hac.com (Seth Goldman 317-5693) writes:
>All of a sudden I can't run X as anyone other than
>superuser.  Somehow I must have trashed the protection
>on some file/device/directory.  My xinit/XmacII process
>quits immediately reporting "killed.".  How do I fix this?

The most likely bet is that you've messed up the protections on
/usr/local/shlib. It, and the files in it, need to be r-xr-xr-x
(well, rwxr-xr-x won't hurt :-)). The key is world read-execute --
shared libraries need to be executable as well as readable.

If that's not it, check protections on: the clients (obviously),
the fonts (the server will die without them), and maybe the
other files in /usr/local/X11/lib/X11...

--John

--------------------------------------------------------------------------
John L. Coolidge     Internet:coolidge@cs.uiuc.edu   UUCP:uiucdcs!coolidge
Of course I don't speak for the U of I (or anyone else except myself)
Copyright 1990 John L. Coolidge. Copying allowed if (and only if) attributed.
You may redistribute this article if and only if your recipients may as well.

x@springer.Apple.COM (X Windows) (10/12/90)

In article <1885@s6.Morgan.COM>, jordan@Morgan.COM (Jordan Hayes) writes:
|> 
|> 	+ #ifdef macII
|> 	+ char *default_server = "XmacII";
|> 	+ #else
|> 	  char *default_server = "X";
|> 	+ #endif
|> 
|> 
|> Don't do this.  
|> 
|> /jordan

Our X Window System product provides a startup script called "X" (which
after much sanity checking, invokes XmacII). IMHO, linking the name X to
the server binary is asking for trouble -- type X, get the root weave
and then the cursor ... and then a call to Tech Support :-)

Steve Peters
X Project Leader
Apple Computer, Inc.
peters@apple.apple.com

jordan@Morgan.COM (Jordan Hayes) (10/15/90)

Steve Peters <peters@Apple.Apple.COM> writes:

	Our X Window System product provides a startup script called
	"X" (which after much sanity checking, invokes XmacII). IMHO,
	linking the name X to the server binary is asking for trouble

I don't really care who forgot to get familiar with X11 at Apple before
trying to market and support a vendor product, but traditionally the X
server is called X.  Call your script something else, but leave
well-accepted conventions alone.

Try "man X" on any reasonable vendor's machine.

-----

  "X is a window system, not a program"
	-- ...

  "You can't be compatible by being incompatible"
	-- usually reserved for explaining another mis-feature of AIX
	   to IBM FEs, but certainly could be applied here ...

/jordan