
Ben Rudiak-Gould
If you're reading from a random-access file, there's no way [select] can tell you when the file data is buffered, because it doesn't know which part of the file you plan to read. The OS may try to guess for readahead purposes, but select()'s behavior can't depend on that guess.
The Glibc documentation says, "select determines if there is data available (more precisely, if a call to read(2) will not block)." I think, this is reasonably precise. The OS does know, where you are going to read (at the file pointer) and if you seek() or pread() instead, well, that is no call to read(2) and may change everything. Thus the question is, does select() reliably tell if read() would block or does it check for something else? Is the documentation wrong (on some platforms)?
This is another example of why the world would be better off with the file/stream model. Have I convinced anyone?
Uhm, well, me thinks, open() and read() on files quite accurately model a stream already... Udo. __________________________________________________________ Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min. weltweit telefonieren! http://freephone.web.de/?mc=021201