git: f2ec444be523 - main - kqueue1(2): document

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 27 Mar 2023 23:39:34 UTC
The branch main has been updated by kib:

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

commit f2ec444be523d3d00808ff82a7c690c75defe953
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-03-25 23:41:21 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-03-27 23:39:26 +0000

    kqueue1(2): document
    
    Reviewed by:    emaste, jhb
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D39271
---
 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 45287813fe13..54143b288dc4 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 c8d39d092b4d..c263fa550244 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