Subject: Re: NEW SNAPSHOT! / xterm & TIOCGPGRP
To: None <port-sparc@sun-lamp.cs.berkeley.edu>
From: - Greg Earle <earle@isolar.Tujunga.CA.US>
List: port-sparc
Date: 04/21/1994 01:03:06
Theo writes:
>New snapshot available, based on sources from around April 16-19 or so.  Took a
>couple of shots to fix a few more bugs, the process of getting snapshots onto
>sun-lamp is now quite automated and I should be able to get them to sun-lamp
>easier.

Back when I asked about how to get "sup" going after I'd gotten a system built
from source, Theo (wisely) advised me to wait, since if I sup'ed and built
post-"off_t" source I'd undoubtedly hose myself big time.  I therefore decided
to sit tight and wait for him to let people know it was safe to come out from
hiding from the big bad 64-bit off_t (-:  Do I take it that with this snapshot,
I could now try and get "sup" running to upgrade my src from the March 27th
pre-"off_t" sources I still have?

>Notes:
>	- I've included shared libraries, but all included binaries
>	  are linked statically
>	- No man pages, sorry.  "grotty" blows chunks.  Hope to have a
>	  fix soon.

I take it this "grotty" problem must have happened in the past 3 weeks?  Once
I had the target directories made and "groff" was happy, I was able to build
all of the March 27th man pages ...

My main reason for posting, however, is X related.  Back a while ago, I
mentioned that I couldn't get my SunOS "Xsun" to run under NetBSD/SPARC.  After
doing some sleuthing, it turned out that the ddx layer I was using, derived
from Kaleb Keithley's "Xsun multi-screen" patches for R5, was trying to mmap()
the cgthree0 framebuffer at a non-zero offset, which the NetBSD driver didn't
like.  A quick flurry of e-mails to Theo, Chris Torek and Kaleb followed, and
Theo came up with a cgthree.c patch that put that problem well away (thanks
Theo!!!).  This will come in real handy in case anyone tries to run an R6 Xsun
binary, because this new ddx code is the default for the R6 Xsun.

Anyway, that got me to the point where I could fire up X and something useful
happened.  I thought I was home free at this point, but then I ran into a
problem that Peter Galbavy mentioned 'way back on March 3rd:

>Just trying to run xterm and I get a "xterm: no available ptys" message.  Using
>"ktrace" and looking at the xterm source, there "seems" to be a difference in
>TIOCGPGRP handling ...
>
[ ... snippet of "xterm" source elided ... ]
>
>for that bit of code.  Should it be returning -1 here?  Or is xterm broken?

I have the *exact* same problem.

None of my xterms will come up, because of the same reason.  My first thought
was "Oh, obviously it's because of the tty/pty major/minor numbers", but I'm
using Theo's latest /dev/MAKEDEV and I re-made all the ttyp?/ptyp? combos with
it, and they're all correct:

netbsd4me:1:23 % ls -l ttyp[01] ptyp[01]
crw-rw-rw-  1 root   wheel   21,   0 Apr 20 23:48 ptyp0
crw-rw-rw-  1 root   wheel   21,   1 Apr 11 22:05 ptyp1
crw--w----  1 earle  tty     20,   0 Apr 20 23:48 ttyp0
crw-rw-rw-  1 root   wheel   20,   1 Apr 11 22:05 ttyp1

I never heard from Peter whether he found a fix for this or not?

The other problem I have is with "xconsole".  When it comes up, instead of
saying "Console log for netbsd4me" it says "Couldn't open console".  And "echo
FOO > /dev/console" blats it directly to the framebuffer.  My only
interpretation is that perhaps a SunOS TIOCCONS ioctl isn't being properly
handled.  I also noticed that under NetBSD, my console mode is

netbsd4me:1:24 % ls -l /dev/console
crw-------  1 earle  tty    0,   0 Apr 16 03:33 /dev/console

whereas under SunOS 4.1.3 it's

isolar:2:59 % ls -gl /dev/console
crw--w----  1 earle    tty        0,   0 Apr 21 00:38 /dev/console*

I tried chmod'ing it g+w thinking maybe the "xconsole" binary needed that, but
that didn't help.

A "ktrace" seemed to show "xconsole" trying to open a gazillion pty's and
failing (the existing ones yield EIO for already-taken and EPERM for those that
aren't; hmmmn).  So I suspect it's related to why "xterm" won't work as well.

Anyone else having troubles with a SunOS-compiled "xconsole" & "xterm"?

If only I could fix these two things (being able to upgrade to -current and
regularly use "sup" would be nice, too; but I can live (-: ) then I could move
full-time to NetBSD!  I need to do it soon, because my spare play-toy machine
will go away not too long from now ...

Thanks for any answers,

	- Greg

------------------------------------------------------------------------------