Setting termios VMIN > 0 and VTIME > 0 on non blocking file

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Wed Mar 11 21:55:50 GMT 2020


On 2020-03-11 14:48, Åke Rehnman via Cygwin wrote:
> opening a file (serial port) with O_NONBLOCK and subsequently setting termios
> VMIN and VTIME > 0 makes read() never ever return any data (returns EAGAIN
> indefinitely).
> Don't ask my why one would want to do something like this but apparently the
> "screen" program think this is a good way of doing things...
> Nevertheless not returning any data ever seems wrong.
> Any insight on how it is supposed to work is welcome.

VMIN > 0 || VTIME > 0 implies blocking; O_NONBLOCK implies SIGIO delivery; see:

	https://www.tldp.org/HOWTO/pdf/Serial-Programming-HOWTO.pdf
	https://www.cmrr.umn.edu/~strupp/serial.html
	https://en.wikibooks.org/wiki/Serial_Programming/termios

also read the man pages carefully and *assume* nothing; functions should work
*exactly* as documented: there be dragons!

You have to set up for, or adapt to, the expected input speed and quantity, the
interrupt response overhead (hardware, OS, and C signal), and what else you want
to be able to do at the same time.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.



More information about the Cygwin mailing list