Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.soft-sys.andrew Subject: Re: Typescript under SunOS 4.1? Message-ID: <3987@auspex.auspex.com> Date: 30 Aug 90 23:43:14 GMT References: <3974@auspex.auspex.com> Organization: Auspex Systems, Santa Clara Lines: 83 >Sounds to me like the right thing to try is to rebuild under 4.1. I'll >try that and report back. Well, I finally dragged our 4.1 documentation out of its box. Starting on page 52 of the SunOS 4.1 Release Manual, there's a discussion of the changes to the controlling terminal stuff in 4.1. It notes that the following BSD-flavored code should cause "/dev/ttya" to become the process's controlling terminal: if ((fd = open("/dev/tty", O_WRONLY)) != -1) { (void) ioctl(fd, TIOCNOTTY, 0); (void) close(fd); } (void) setpgrp(0, 0); fd = open("/dev/ttya", O_RDWR); and that the following code might *not* do so: if ((fd = open("/dev/tty", O_WRONLY)) != -1) { (void) ioctl(fd, TIOCNOTTY, 0); (void) close(fd); } fd = open("/dev/ttya", O_RDWR); because, while in 4.xBSD, the TIOCNOTTY "ioctl" will zero out the process's process group, it will not do so in SunOS 4.1. Now, the code in ".../atk/typescript/tscript.c" that releases the controlling tty is, for non-HP-UX systems: { int fd; (void)signal(SIGTTOU,SIG_IGN); /* For handling signals when changing the window size */ fd = open ("/dev/tty", O_RDWR); if (fd >= 0) { ioctl (fd, TIOCNOTTY, 0); close (fd); } #if SY_AIX221 else { ioctl(0, TIOCNOTTY, 0); /* might help when /dev/tty is hosed */ setpgrp(); } #else else setpgrp(0, 0); #endif } The astute reader will note that this is similar to the second section of code - the one that the documentation says won't work. Given that in 4.xBSD TIOCNOTTY will set the process group to 0, it appears that it would be harmless to change the code to: { int fd; (void)signal(SIGTTOU,SIG_IGN); /* For handling signals when changing the window size */ fd = open ("/dev/tty", O_RDWR); if (fd >= 0) { ioctl (fd, TIOCNOTTY, 0); close (fd); } #if SY_AIX221 else { ioctl(0, TIOCNOTTY, 0); /* might help when /dev/tty is hosed */ setpgrp(); } #else setpgrp(0, 0); #endif } so that the "setpgrp(0, 0)" is *always* done. This should probably be tried both on a SunOS 4.1 system, and on some non-HP-UX, non-AIX systems, to see if it works on both systems. If so, the change should be put in (no #ifdefs for SunOS 4.1, please, if it works both on SunOS 4.1 and other systems; the code has enough #ifdefs already).