aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2023-03-31 18:50:26 +0000
committerEd Maste <emaste@FreeBSD.org>2023-04-04 13:29:53 +0000
commit20c9c3be5acc66de9081f1f24456a62ba9395c4f (patch)
treea4d35412590cf3c95490378e46fc6a5475410f1d
parent11cdffc60325580d55e0ab835429d3fda2cbc8fb (diff)
downloadsrc-20c9c3be5acc66de9081f1f24456a62ba9395c4f.tar.gz
src-20c9c3be5acc66de9081f1f24456a62ba9395c4f.zip
kqueue: add close() calls to man page example
There is no real need to close descriptors before a process exits, but these close calls demonstrate by example that kqueue descriptors occupy the same namespace as other file descriptors. Reviewed by: fernape, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39376
-rw-r--r--lib/libc/sys/kqueue.24
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2
index af60bb396d6a..cad4361f2b3c 100644
--- a/lib/libc/sys/kqueue.2
+++ b/lib/libc/sys/kqueue.2
@@ -773,6 +773,10 @@ main(int argc, char **argv)
printf("Something was written in '%s'\en", argv[1]);
}
}
+
+ /* kqueues are destroyed upon close() */
+ (void)close(kq);
+ (void)close(fd);
}
.Ed
.Sh ERRORS