Subject: Re: improving kqueue
To: Matthew Mondor <>
From: Julio M. Merino Vidal <>
List: tech-kern
Date: 09/21/2006 17:08:23
On 9/21/06, Matthew Mondor <> wrote:
> If I understand (from on and off-list discussion), you want to receive
> notifications for a whole file hierarchy, while kqueue only allows you
> to listen for events for one directory/file per open file descriptor,
> and closing the descriptor of course discards any filter for it.
> This means that to implement something like fam(8) would mean
> recursively scanning a tree and opening a very high number of
> descriptors, which then becomes more problematic than occasionally
> recursively rescanning the whole tree using fstat(2) on every file at
> the expense of less real-time notification...
> [...]
> If this was implemented and worked, there yet would remain another
> problem to solve, however, which is inode to full path name resolution.
> A possible solution would be to have your application maintain in
> userspace a btree or hash table of inode->name entries which it would
> need to populate firsthand and maintain through the course of the
> application as events are received.  This however can probably waste a
> considerable amount of memory.

This is exactly what the kqueue patches for fam(8) do, which are
really suboptimal.

Julio M. Merino Vidal <>
The Julipedia -