HELP: Low level terminal I/O
Vernon Schryver
vjs at rhyolite.wpd.sgi.com
Sat Jul 29 05:39:18 AEST 1989
In article <8907201857.aa12017 at SMOKE.BRL.MIL>, mis at APL.STANFORD.EDU (Misha Pavel) writes:
> ...
> I was hoping that the term.c_cc[VTIME] = 0 would do the job.
> But the system seems to be still waiting for at least one char.
>
> Is there any way to look at the system buffer and or return
> from read() when no input was generated?
> ...
>
> Misha Pavel <mis at psych.Stanford.Edu>
System V has a confusing notion of VTIME/VMIN. It likes to wait for at
least one character. I seem to recall that there is a combination which
does not wait, but there is no reason to suffer the pain of reading the
SVID (the only place I know where it is half way documented), or of reading
either SGI's stty_ld.c or the standard SVR3 line discipline code.
You could use the FIONNBIO ioctl(2) on an FD that is a tty or socket.
I would use select(2) instead. Select(2) has always worked on streams
(tty's) and sockets. It allows fine grain timeouts and simultaneous
polling of lots of FD's, for reading and/or writing. It now works on
everything. Now is 3.2, or maybe some version of 3.1. It was added to
lboot(1), cdev[], etc. seemingly a long time ago.
Vernon Schryver
Silicon Graphics
vjs at sgi.com
More information about the Comp.sys.sgi
mailing list