Subject: HEADS UP: kqueue support merged
To: None <current-users@netbsd.org, tech-kern@netbsd.org>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: current-users
Date: 10/23/2002 23:33:22
Support for kqueue has been merged to -current today. This code
is based upon code written by Jonathan Lemon from FreeBSD
project. The NetBSD port was done by Luke Mewburn, Jason Thorpe
and Jaromir Dolecek.

Kqueue provides a generic method of notifying the user
when an event happens or a condition holds, based on the results
of small pieces of kernel code termed filters.

Since kqueue provides stateful interface to poll many descriptors
at once, it's ideal for applications which need to watch large,
mainly constant set of descriptors, for which poll(2)/select(2)
has significant system overhead.  Example applications which might
benefit from kqueue are web servers, proxies, ircd etc.

Kqueue also provides support for watching files and directories
for changes. This means that e.g. file managers can use kqueue
instead of periodic stat(2) on the directory nodes. It's my
understanding that e.g. Samba could make a good use of this too;
Samba needs to watch&report file/directory changes to support
the Microsoft Windows change notification filters.
This particular feature has been missing in Unix systems for a long
time, and it's good it's finally coming to NetBSD too.

On NetBSD, kqueue is supported by every device driver supporting
poll(2), so kqueue can be used as replacement for select(2)/poll(2)
in all cases. Also, we support filesystem kevents for all writable
local filesystems (including ffs, lfs, ext2fs, msdosfs) and also
for NFS. Thus, file managers and file servers can depend on the
functionality to be present for any filesystem likely to be used
as file storage.

There are some plans to add glue for notification of e.g. USB
devices additions/removals to userland or to support e.g. ifwatchd
functionality better way in future. The code is extensible
well and any additional filters like that are easy to add.

For more detailed information, see Jonathan's paper available at
	http://people.freebsd.org/~jlemon/papers/kqueue.pdf
or
	http://people.freebsd.org/~jlemon/papers/kqueue.ps

and/or the NetBSD kqueue(2) manpage.

Enjoy,

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.org/
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-