Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jun 2003 22:10:58 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Joshua Oreman <oremanj@webserver.get-linux.org>
Cc:        hackers@freebsd.org
Subject:   Re: kqueue alternative?
Message-ID:  <3EEEA2E2.6E4A2409@mindspring.com>
References:  <1079.10.0.81.10.1055692530.squirrel@www.mundomateo.com> <Pine.NEB.3.96L.1030615125423.98988D-100000@fledge.watson.org> <Pine.NEB.3.96L.1030615125423.98988D-100000@fledge.watson.org> <20030616171110.GC56734@webserver.get-linux.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Joshua Oreman wrote:
> > >I would say, use select(2).
> > >Is there a reason this wouldn't work?
> >
> > 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?

Select blocks on readfds if a read from the file would block;
that is never the case with a file: you will either get data,
or you will get an EOF.  Select blocks on writefds if a write
to the file would block; that is never the case with a file:
you will either successfully write, or you will get an error,
e.g. as a result of exceeding quota, etc..

Therefore a select for reads or writes on a disk file should
always return true.

-- Terry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EEEA2E2.6E4A2409>