Subject: Re: bumping default open descriptors
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 04/02/2004 16:39:53
--0/kgSOzhNoDC5T3a
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Apr 02, 2004 at 02:11:18PM -0500, der Mouse wrote:
> Now, if you mean "raising FD_SETSIZE will break _binary_
> compataibility", then yes, you are correct: if svc_getreqset is built
> with a larger FD_SETSIZE than its caller, it will access beyond the
> fd_set its caller passes in.  This can be fixed with symbol versioning.
> I see nothing else with ABI breakage (except __svc_clean_idle, which I
> assume should not be called outside libc).  There are already issues
> with using sunrpc calls when using a user-raised FD_SETSIZE....

Yes, I meant _binary_ compatability. :-)

About __svc_clean_idle() (which I haven't looked at), will it ever be=20
called on a user-supplied fd set? If so, then even though it's internal to=
=20
libc, it can cause issues.

Symbol versioning will probably cover the problems, though.

> Perhaps I missed something, but I am inclined to doubt it; I tend to
> trust grep. :-)
>=20
> >> [...select()...poll()...]
> > Use kevent().  It 1) scales very well, and 2) is much nicer.
>=20
> It also appears to be kernel-internal-only, based on searching
> /usr/src/share/man/ for files containing "kevent" and thus is
> irrelevant to a discussion of select vs poll.

Try looking in /usr/src/lib/libc/sys, specifically at=20
/usr/src/lib/libc/sys/kqueue.2, which gets installed as both kqueue.2 and=
=20
kevent.2.

Check it out, as it's why we got to O(1) for monitoring multiple incoming=
=20
event streams. I have changed a program from poll() to kevent(), and it=20
wasn't that hard. Since you get an arbitrary void * back as part of the=20
event, you can store either the appropriate function pointer or object=20
pointer in the event filter and thus make a very simple event dispatcher.=
=20
Look at powerd as an example.

Additionally, since there is a timer event filter, you can make it so that=
=20
you don't need to pass in a timeout to the call; you'll just have a filter=
=20
go off each time it expires. As you can get an timeout count, you don't=20
have to worry about spending too much time in a callout (thus missing=20
ticks of your periodic timer).

Take care,

Bill

--0/kgSOzhNoDC5T3a
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFAbgfZWz+3JHUci9cRAtyZAJ9CJHT4HYX/AivGa8OikH+N2Koz5wCeI1Sh
GDfoy6AJ+BEcm2gIP7VqAyo=
=0Qsr
-----END PGP SIGNATURE-----

--0/kgSOzhNoDC5T3a--