Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site wjvax.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!alberta!ubc-vision!uw-beaver!tektronix!hplabs!pesnta!greipa!decwrl!sun!qubix!wjvax!brett From: brett@wjvax.UUCP (Brett Galloway) Newsgroups: net.unix-wizards,net.bugs.4bsd Subject: Strange behaviour of select() call when ^Z typed, (4.2BSD) Message-ID: <568@wjvax.UUCP> Date: Fri, 27-Sep-85 15:35:21 EDT Article-I.D.: wjvax.568 Posted: Fri Sep 27 15:35:21 1985 Date-Received: Wed, 2-Oct-85 08:42:39 EDT Reply-To: brett@wjvax.UUCP (Brett Galloway) Organization: Watkins Johnson, San Jose, Calif. Lines: 44 Xref: watmath net.unix-wizards:15054 net.bugs.4bsd:1780 The following program illustrates what may be a bug in the select() call (and the underlying kernel code): ----------- Start of file ----------------- #include main(argc,argv) { char buf[32]; int readfds; int i; while(1) { printf("Type something: "); fflush(stdout); readfds=1; if(select(1,&readfds,0,0,0) > 0) { gets(buf); printf("'%s' typed.\n",buf); if(buf[0] == '~') break; } } } ------------ End of file ------------- When this is executed, and ^Z is typed at the prompt (i.e. while the program is sitting in the select()), the program does stop, but then its status changes. The csh detects a stopped state, but the program's process in fact exits. This bug is (seemingly) intermittent. I have other programs which sit on select()'s for input which may or may not die when a SIGTSTP signal is sent to them. Sending SIGTSTP instead of typing ^Z may also cause the process to die. Sending SIGTSTP to a process on a pipe, however, never caused it to die, so I assume that this problem involves some interaction with the (new) tty driver. Does anyone out there know what is happening? If so, I would appreciate hearing about it. Brought to you by Super Global Mega Corp .com