[comp.unix.questions] NOFLSH

ken@rochester.UUCP (03/27/87)

[BSD 4.2/3, Vax]

I have a program which enables SIGCHLD (a command shell, to be exact).
The shell uses SIGCHLD to detect that a command has finished.  What is
happening is that last part of the output from each command is being
dropped. Is this what setting NOFLSH is intended to prevent, i.e. to
prevent output from being dropped on the floor on receipt of a signal?

Example:

	% ls
	....
	(last few lines lost but not always the same number)
	%

Thanks in advance.

	Ken

mouse@mcgill-vision.UUCP (04/02/87)

In article <26429@rochester.ARPA>, ken@rochester.ARPA (Ken Yap) writes:
> [BSD 4.2/3, Vax]

> I have a program which enables SIGCHLD (a command shell, to be
> exact).  The shell uses SIGCHLD to detect that a command has
> finished.  What is happening is that last part of the output from
> each command is being dropped.  Is this what setting NOFLSH is
> intended to prevent, i.e. to prevent output from being dropped on the
> floor on receipt of a signal?

No.  Searching our kernel source, NOFLSH is used only to suppress
flushing of output on generation of a signal due to a typed character,
eg,

% command-with-much-output
....
....
^C
(output shuts off immediately, the thousands of bytes stored up in the
 tty output queue being thrown away instead of printed)
%

This happens only for the interrupt, quit, and suspend characters.  You
normally want NOFLSH turned off, that is, flushing enabled.

What I think is much more likely to be your problem is that your
"shell" is playing with the terminal settings, and in the so doing is
managing to flush the tty queues.  Are you using TIOCSETP (TIOCSETN
doesn't flush the tty queues, TIOCSETP does)?  Are you setting RAW mode
(which will flush the tty queues)?  Problem arises because ls (say)
prints all its output and exits, leaving the output in the tty output
queue.  If the shell does something which flushes output soon enough
after ls exits, soon enough that the tty driver hasn't printed all the
output yet, then some of the output will be lost.

					der Mouse

Smart mailers: mouse@mcgill-vision.uucp
USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!musocs!mcgill-vision!mouse
     think!mosart!mcgill-vision!mouse
ARPAnet: think!mosart!mcgill-vision!mouse@harvard.harvard.edu