Path: utzoo!attcan!uunet!ginosko!aplcen!haven!ames!sgi!vjs@rhyolite.wpd.sgi.com From: vjs@rhyolite.wpd.sgi.com (Vernon Schryver) Newsgroups: comp.sys.sgi Subject: Re: HELP: Low level terminal I/O Summary: use select(2) Message-ID: <39141@sgi.SGI.COM> Date: 28 Jul 89 19:39:18 GMT References: <8907201857.aa12017@SMOKE.BRL.MIL> Sender: daemon@sgi.SGI.COM Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 29 In article <8907201857.aa12017@SMOKE.BRL.MIL>, mis@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 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@sgi.com