git: 0e3a044e4c4b - stable/15 - kqueue.2: document EVFILT_PROCDESC support for NOTE_FORK

Konstantin Belousov <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.devel.stable.scm
Message-ID <[email protected]>
The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=0e3a044e4c4b0af4f25db6695d9340a7a7e57c2d

commit 0e3a044e4c4b0af4f25db6695d9340a7a7e57c2d
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2026-07-17 05:38:57 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-08-16 02:41:33 +0000

    kqueue.2: document EVFILT_PROCDESC support for NOTE_FORK
    
    (cherry picked from commit 3f88f6b89942a7f3aa6bb682b02b7307d060b52f)
---
 lib/libsys/kqueue.2 | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/lib/libsys/kqueue.2 b/lib/libsys/kqueue.2
index 5e0b80280a81..1ac337e78b38 100644
--- a/lib/libsys/kqueue.2
+++ b/lib/libsys/kqueue.2
@@ -598,6 +598,41 @@ The events to monitor are:
 The process has exited.
 The exit status will be stored in
 .Va data .
+.It Dv NOTE_FORK
+The process has forked.
+The process identifier
+.Pq PID
+of the most recently forked child is returned in the
+.Va data
+field.
+.Pp
+The identifier is advisory;
+if several children were spawned before the event is returned,
+only one of the PIDs is returned.
+Other mechanisms provide reliable reporting of fork events.
+For instance, debugging the process with a subscription for relevant
+events would serialize forks.
+See
+.Xr ptrace 2
+and the description of the
+.Dv PT_FOLLOW_FORK
+request.
+.Pp
+Unlike the
+.Dv EVFILT_PROC
+filter,
+the
+.Dv NOTE_TRACK
+pseudo-event is not supported.
+.Pp
+If both
+.Dv NOTE_EXIT
+and
+.Dv NOTE_FORK
+events are reported, then the
+.Va data
+field contains the exit status of the process,
+and the last child's PID is not returned.
 .It Dv NOTE_PDSIGCHLD
 Activates on events that are reported through
 .Xr pdwait 2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.