kqueue alternative?

Wes Peters wes at softweyr.com
Mon Jun 16 23:11:04 PDT 2003


On Monday 16 June 2003 11:39 am, Eric Jacobs wrote:
> On Mon, 16 Jun 2003 10:11:10 -0700
>
> Joshua Oreman <oremanj at www.get-linux.org> wrote:
> > On Mon, Jun 16, 2003 at 11:44:15AM +0100 or thereabouts, Tony Finch 
seemed to write:
> > > 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?
>
> A file descriptor that references an ordinary vnode (file or directory)
> will always be "ready for I/O", because unlike a socket or pipe, it
> never needs to block in order to tell you if it's at EOF.
>
> So, while it works, and is logical, it isn't terribly useful.

It's useful from the standpoint that the same select code that works with 
a device or socket handle, both of which can block, will work with a file 
handle that can't block or a pipe handle that can block.  Looked at in 
this light, it would be really stupid if select didn't behave as it does 
when fed a file handle.

-- 

        Where am I, and what am I doing in this handbasket?

Wes Peters                                               wes at softweyr.com



More information about the freebsd-hackers mailing list