[comp.bugs.4bsd] Porting the 4.3BSD-Tahoe `window' to a Sun

earle@mahendo.Jpl.Nasa.Gov (Greg Earle) (01/21/89)

Recently I decided to try my hand at porting the 4.3BSD-Tahoe version of
`window' to a Sun-3, running SunOS 4.0.1+.  After a wee bit of hacking,
and the not-inconsiderable help of Guy Harris, I had a version that would
work fine, when using pty's for the screen windows.  However, when I
attempt to have it use UNIX domain socketpairs for the windows (i.e.,
specify `pty = no' in ~/.windowrc), I get very strange behavior:
The window is allocated properly, and a shell is spawned for it.  Yet,
no shell prompt shows up in the window, and keyboard input (when that window is
selected) doesn't seem to go anywhere.  Yet if I kill the spawned csh
from another place, `window' knows that the child has been killed, and I
get the expected `Process died.  Command?' prompt in the command window.
It's as if the spawned csh is orphaned out in the Twilight Zone, with its
stdin and stdout disconnected from everything.

An `sps -avl' immediately after an initial creation of a socketpair() based
window, and a pty-based window, shows:

Ty User     Status Fl Nice Virt Res %M  Time Child %C Proc# Command
p0.     *   SELECT         152  400  6   0.8        2  1770 window
         *  RSOCKT          64  344  5   1.2        5  1771 csh
p4.      *  RTTYP4          64  352  5   1.2        5  1773 -sh

Other than the `csh' instead of `-sh' (??), this looks pretty reasonable
to me.

[I'd show an `sps -avle' to see the environments of each are any different,]
[but sps' -e option has a bug that causes a Bus Error, at least on the Sun.]

[On a somewhat related note, compiling `window' with gcc causes it to botch]
[the termcap string for inverse video, at least inside the xterm I was     ]
[testing it in.								   ]

Any ideas?
-- 
	Greg Earle		earle@Sun.COM
	Sun Microsystems	poseur!earle@mahendo.JPL.NASA.GOV
	Los Angeles Consulting	earle%mahendo@elroy.JPL.NASA.GOV
...!{cit-vax,ames}!elroy!poseur!earle	...!sun!tsunami!valley!poseur!earle