kqueue alternative?

Stephen Montgomery-Smith stephen at math.missouri.edu
Mon Jun 16 11:17:17 PDT 2003


>>Select doesn't work with files.
> 
> 
> Really? `man 2 select' says nothing about that. It just talks about
> 'file descriptors'. Now if it said 'socket descriptors' or 'non-file
> file descriptors' I would understand, but I don't think that that statement
> is implied by the man page. Is there something I'm missing?
> 

Well I did a little experimentation.  It looks like this.  select will say that 
a file is ready for reading if read(2) will not block.  However, if you get to 
an end of file, then read does not block, rather it returns 0 to indicate end of 
file.  Thus select will not block and will say that this file is ready for 
reading.  In essence, calling select will always say that a file is ready for 
reading, and calling select serves no purpose.

Well I definitely learned something.


-- 
Stephen Montgomery-Smith
stephen at math.missouri.edu
http://www.math.missouri.edu/~stephen



More information about the freebsd-hackers mailing list