git: 78182897b6a2 - stable/13 - kqueue1(2): document

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 16 Apr 2023 11:10:29 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=78182897b6a238161466c29dd8941bfc147f0b79

commit 78182897b6a238161466c29dd8941bfc147f0b79
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-03-25 23:41:21 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-04-16 10:59:43 +0000

    kqueue1(2): document
    
    (cherry picked from commit f2ec444be523d3d00808ff82a7c690c75defe953)
---
 lib/libc/sys/Makefile.inc |  1 +
 lib/libc/sys/kqueue.2     | 20 +++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 6f663158d840..4152d01a0f3d 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -430,6 +430,7 @@ MLINKS+=jail.2 jail_attach.2 \
 	jail.2 jail_set.2
 MLINKS+=kldunload.2 kldunloadf.2
 MLINKS+=kqueue.2 kevent.2 \
+	kqueue.2 kqueue1.2 \
 	kqueue.2 EV_SET.3
 MLINKS+=link.2 linkat.2
 MLINKS+=madvise.2 posix_madvise.2
diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2
index 863136c9928f..dbe0dad532c0 100644
--- a/lib/libc/sys/kqueue.2
+++ b/lib/libc/sys/kqueue.2
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 14, 2022
+.Dd March 26, 2023
 .Dt KQUEUE 2
 .Os
 .Sh NAME
@@ -38,6 +38,8 @@
 .Ft int
 .Fn kqueue "void"
 .Ft int
+.Fn kqueue1 "u_int flags"
+.Ft int
 .Fo kevent
 .Fa "int kq"
 .Fa "const struct kevent *changelist"
@@ -90,6 +92,22 @@ flag, then the descriptor table is shared,
 which will allow sharing of the kqueue between two processes.
 .Pp
 The
+.Fn kqueue1
+system call also creates a new kernel event queue, and additionally takes
+the
+.Fa flags
+argument, which is a bitwise-inclusive OR of the following flags:
+.Bl -tag -width "KQUEUE_CLOEXEC"
+.It Fa KQUEUE_CLOEXEC
+The returned file descriptor is automatically closed on
+.Xr execve 2
+.El
+The
+.Ql fd = kqueue()
+call is equivalent to
+.Ql fd = kqueue1(0) .
+.Pp
+The
 .Fn kevent
 system call
 is used to register events with the queue, and return any pending