Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!gatech!bbn!diamond.bbn.com!aweinste From: aweinste@bbn.com (Anders Weinstein) Newsgroups: comp.unix.wizards,comp.bugs.4bsd Subject: tty selects for input in background processes Message-ID: <7510@diamond.BBN.COM> Date: Tue, 28-Jul-87 18:57:31 EDT Article-I.D.: diamond.7510 Posted: Tue Jul 28 18:57:31 1987 Date-Received: Thu, 30-Jul-87 03:37:21 EDT Reply-To: aweinste@bbn.com (Anders Weinstein) Distribution: world Organization: BBN Laboratories Incorporated, Cambridge, MA Lines: 17 Xref: mnetor comp.unix.wizards:3462 comp.bugs.4bsd:467 In both 4.2 & 4.3, a select on a tty will return with input ready *even if* the selecting process is in the background and can't actually read the typed line or character. The FIONREAD ioctl has the same defect. I place the bug in the "ttnread" routine, which is missing the appropriate check on the process groups. This has stymied my attempt to write a user-ftp-like program which must multiplex handling tty commands with network input (and is very likely to be kept in the background while idle). I know I can avoid blocking on the background read attempts, but I don't want the idle process to wake up every time the user types a line in the foreground. I'm considering spawning another process (/bin/cat comes to mind) just to funnel me the tty input through a pipe -- this all just so I can do a select on it. Any alternative suggestions would be welcome. Anders Weinstein BBN Labs