Undocumented 4.2 tty driver features

Tom Truscott trt at rti-sel.UUCP
Sat Aug 24 01:19:49 AEST 1985


As you point out, the FREAD/FWRITE parameter to the TIOCFLUSH ioctl
is not merely undocumented, it is required!  That is:
	ioctl(fd, TIOCFLUSH, (char *)0);
is a NOP on 4.2 BSD/VAX.  I suppose this feature is widely known,
but I have noticed some programs that have these NOPs in them.
For example, the 'flushinp()' routine in Pavel Curtis' terminfo.

The correct way to flush input is, of course:
	#include <file.h>
	int flushread = FREAD;
	...
	ioctl(fd, TIOCFLUSH, (char *)&flushread);

It would be nice if a third parameter of '(char *)0' had the effect
of flushing both input and output.  Perhaps in 4.3 BSD?
	Tom Truscott



More information about the Comp.unix.wizards mailing list