Page MenuHomeFreeBSD

kqueue(2) support for jails
ClosedPublic

Authored by jamie on Aug 17 2025, 12:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 12, 12:46 AM
Unknown Object (File)
Sat, Oct 11, 3:16 PM
Unknown Object (File)
Sat, Oct 11, 3:16 PM
Unknown Object (File)
Sat, Oct 11, 3:16 PM
Unknown Object (File)
Sat, Oct 4, 11:54 PM
Unknown Object (File)
Thu, Sep 18, 8:37 PM
Unknown Object (File)
Thu, Sep 18, 12:11 PM
Unknown Object (File)
Thu, Sep 18, 5:35 AM

Details

Summary

Add kqueue tracking to jails, inspired by how it's done with processes. EVFILT_JAIL takes a jail ID, and tracks with NOTE_JAIL_SET, NOTE_JAIL_ATTACH, NOTE_JAIL_REMOVE, and NOTE_JAIL_CHILD. It also uses the NOTE_TRACK mechanism that EVFILT_PROC uses, using the same result flags (NOTE_CHILD and NOTE_TRACKERR).

Watching JID 0 attaches to the current prison, allowing a process to track the creation of new jails as they are created. It also means a jailed process can tell when its own jail has been changed or added to, but that's neither useful nor dangerous.

This is a companion to the jail descriptor work in D43696, which had kqueue support for jail descriptors. The goal is to have kqueue for jails both by ID and by descriptor, using the same note flags.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable