[comp.windows.x] X11 under SunOS4.0.

jsol@bu-cs.BU.EDU (Jon Solomon) (09/17/88)

Has anyone gotten X11R2 to work under SunOS 4.0? We have Sun 3/50s and
a Sun 4/280, and there are a few problems I'd like to discuss with anyone
who has done the work.

--jsol

valdis@alchemy.mcs.clarkson.edu (& Kletnieks) (09/20/88)

I installed X11R2 under SunOS 4.0, didn't have many problems.
We have Sun 3/50's and Sun 3/260's for the most part.

You *do* need to install the 'xterm' patch (the one that eliminates
the 'close' call on fd 3 (or 4?) so the YP routines don't barf).

Also, call your Sun office, and talk to them about ECO 3051 against
3/50's - SunOS 4.0 tickles a bug in the paging hardware on older 50's.
It resulted in either a Suntools console window going poof, or in the
case of X11, the whole X server went away and the user got logged out.
Installation of the ECO seems to have cured this (no hits in the week since
we did it).

Question of the week:  Will X11R3 support the SunOS 4.0 shared library
mechanism, or should I look at hacking it up myself?  I know it's a bit
of a performance hit the one way, but saving that much core looks like a
big win, especially on our Sun 3/50's.

				Valdis Kletnieks
				Sr. Systems Programmer
				Clarkson University

valdis@alchemy.mcs.clarkson.edu (& Kletnieks) (09/21/88)

OK.. Since I've already gotten 2 e-mail msgs asking for the xterm/SunOS 4.0
fix, here it is...  I just fed this to patch, and it worked for me.
Include usual disclaimers - I didn't write the patch, I just use it.

Article 2372 of comp.windows.x
Path: sun.soe.clarkson.edu!batcomputer!cornell!mailrus!ames!oliveb!intelca!mipos3!pinkas
From: pinkas@happy.intel.com (Israel Pinkas ~)
Newsgroups: comp.windows.x
Subject: Re: xterm problems with SunOS 4.0
Message-ID: <PINKAS.88Aug1180910@happy.intel.com>
Date: 1 Aug 88 09:09:10 GMT
Sender: nobody@mipos3.intel.com
Distribution: comp
Organization: Corporate CAD, INTeL Corporation, Santa Clara, CA
Lines: 110


bst@alice.uucp (at AT&T Bell Labs, Murray Hill) posted a set of diffs for
xterm that allowed it to run under SunOS 4.0.  Unfortunately, he posted a
diff file that was reversed.  Fortunately, I used patch, which caught this.

Enclosed is a context diff.  This was done after installing bst's patches
on my X10.4 sources.  bst had originally posted the diffs for X11.2, but
they installed in my source offset by ~200 lines without a problem.

To desribe the problem, I run X10.4 on a Sun386i running YP.  When I don't
have a local passwd entry (as we like to do), I would get an error message
from xterm right after clicking with the left button during the create
window.  xterm would bomb out.  The error message was:

	xterm: Error 31, errno 5:

We discovered that this only happend when DISPLAY was set to something
other than unix:0.  According to bst's post (dated 7/21), the error was due
to the YP file descriptor being open.

Anyway, it works for me in X10.4.  It should work with X11.2, but I have no
way of testing it.  I also can't test whether this will break xterm on
anything else.

-Israel Pinkas

----------------------------------------------------------------------
*** main.c.orig	Fri Jun 10 14:55:54 1988
--- main.c	Mon Aug  1 17:20:54 1988
***************
*** 1143,1152 ****
  
  		get_pty (&screen->respond, &tty);
  
! 		if (screen->respond != Xsocket + 1) {
! 			dup2 (screen->respond, Xsocket + 1);
  			close (screen->respond);
! 			screen->respond = Xsocket + 1;
  		}
  
  		/* change ownership of tty to real group and user id */
--- 1143,1152 ----
  
  		get_pty (&screen->respond, &tty);
  
! 		if (screen->respond < 3) {
! 			int newrespond = dupHigh (screen->respond);
  			close (screen->respond);
! 			screen->respond = newrespond;
  		}
  
  		/* change ownership of tty to real group and user id */
***************
*** 1155,1164 ****
  		/* change protection of tty */
  		chmod (ttydev, 0622);
  
! 		if (tty != Xsocket + 2)	{
! 			dup2 (tty, Xsocket + 2);
  			close (tty);
! 			tty = Xsocket + 2;
  		}
  
  		/* set the new terminal's state to be the old one's 
--- 1155,1164 ----
  		/* change protection of tty */
  		chmod (ttydev, 0622);
  
! 		if (tty < 3) {
! 			int newtty = dupHigh (tty);
  			close (tty);
! 			tty = newtty;
  		}
  
  		/* set the new terminal's state to be the old one's 
***************
*** 1531,1533 ****
--- 1531,1553 ----
  	return(ret);
  }
  #endif	opcode
+ 
+ 
+ int dupHigh(oldfd)
+ {
+     int desc[3],i,j;
+     /* Find an fd > 2 */
+     for (i=0;i<3;i++) {
+ 	desc[i] = dup(oldfd);
+ 	if (desc[i] > 2)
+ 	    break;
+ 	}
+     if (i==3) {
+ 	fprintf(stderr,"dupHigh failed\n");
+ 	exit(1);
+ 	}
+     /* Close unneeded ones */
+     for (j=0;j<i;j++)
+ 	close(desc[j]);
+     return  desc[i];
+ }
--
--------------------------------------
Disclaimer: The above are my personal opinions, and in no way represent
the opinions of Intel Corporation.  In no way should the above be taken
to be a statement of Intel.

UUCP:	{amdcad,decwrl,hplabs,oliveb,pur-ee,qantel}!intelca!mipos3!cadev4!pinkas
ARPA:	pinkas%cadev4.intel.com@relay.cs.net
CSNET:	pinkas%cadev4.intel.com