git: 20c9c3be5acc - main - kqueue: add close() calls to man page example
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 04 Apr 2023 13:30:01 UTC
The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=20c9c3be5acc66de9081f1f24456a62ba9395c4f commit 20c9c3be5acc66de9081f1f24456a62ba9395c4f Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2023-03-31 18:50:26 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2023-04-04 13:29:53 +0000 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 --- lib/libc/sys/kqueue.2 | 4 ++++ 1 file changed, 4 insertions(+) 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