|
|
|
|
|
by haberman
4095 days ago
|
|
> poll(), select() et al don't define "readable" as meaning "a byte of data is available". They define it as "read() will not block". If that were true, poll() wouldn't return read-ready on a file-based fd until the data was actually sitting in buffers. After all, that's the only way to guarantee it won't block. That would actually be a useful semantic. But what actually happens is that poll() on a file-based fd is basically a no-op that always returns true immediately, AFAIK. Someone could pull the disk drive cable before you actually call read(), in which case read() will indeed block, forever. The existing semantic is useless. What argument is there in favor of a useless semantic? This semantic wouldn't solve the "tail -f" problem, but at least it would be useful: http://cr.yp.to/unix/asyncdisk.html |
|