kqueue(2) kevents for jails

Konstantin Belousov kostikbel at gmail.com
Fri Jan 4 16:14:53 UTC 2019


On Fri, Jan 04, 2019 at 02:55:05PM +0100, Fabian Freyer wrote:
> Hi!
> 
> I'm writing a jail management library [1], and am wondering if there's 
> any nice way to get notified of jail state changes (especially running 
> -> dying -> dead) as well as of parameter changes.
> 
> What are the opinions on adding a kevent(2) for these things?
> 
> Fabian
> 
> [1] https://github.com/fubarnetes/libjail-rs/
No, kevent(2) is not suitable mechanism to notify about jail state changes.
If anything in the existing system can be reused for such notifications,
it is devctl(4) notifications which are handled by devd(8).  Look at the
man pages and for existing notifications in kernel code, e.g.
sys/kern/kern_conf.c notify*() for how devfs does it.

It is both more natural and much easier integrated with the jail code.
Not least because jail creation/destruction is relatively low frequency
events with potentially rich secondary information that should be attached
to them.  Kevents are high-frequency, high-performance kind of events,
and only naturally tied to file descriptors.  There were lot of bugs in
integration of kevents with e.g. processes notifications, and API is
still somewhat racy.



More information about the freebsd-jail mailing list