This is the mail archive of the
mailing list for the newlib project.
VMIN/VTIME and read expectations
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: "newlib at sources dot redhat dot com" <newlib at sources dot redhat dot com>
- Date: Thu, 17 Dec 2009 16:16:14 -0600
- Subject: VMIN/VTIME and read expectations
I have been looking into a program on RTEMS that
uses VMIN=0, VTIME=255. The program calls
fgetc() which calls read().
fp->_flags == 0x2806 before the fgetc() call.
read() times out and returns 0.
fgetc() returns -1 and fp->_flags == 0x2826
The 0x0020 being set is _SEOF.
My questions are:
+ Is this correct behaviour?
+ How does the application programmer distinguish
between a real EOF and an unsatisfied read? Even the
Fedora read(2) man page says:
On success, the number of bytes read is returned (zero indicates
file), and the file position is advanced by this number.
So even if I dropped down to read(2), I still don't know
how to distinguish EOF from a read timeout.
Joel Sherrill, Ph.D. Director of Research& Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985