Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2019 18:14:43 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Cc:        freebsd-jail@freebsd.org, stefan@gronke.net
Subject:   Re: kqueue(2) kevents for jails
Message-ID:  <20190104161443.GM2326@kib.kiev.ua>
In-Reply-To: <106dc2ec-9b92-6885-ca4c-8422e0aa061c@physik.tu-berlin.de>
References:  <106dc2ec-9b92-6885-ca4c-8422e0aa061c@physik.tu-berlin.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190104161443.GM2326>