The FreeBSD kqueue(2) man page says the following about NOTE_WAIT: "NOTE_EXIT The process has exited. The exit status will be stored in data." The OpenBSD kqueue(2) man page, however, provides a help detail: "NOTE_EXIT: The process has exited. The exit status will be stored in data in the same format as the status set by wait(2)." That little note in FreeBSD would have saved me several hours.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=7406ec4ea99c1c61e88d5c98c58094093b9e78fb commit 7406ec4ea99c1c61e88d5c98c58094093b9e78fb Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-01-19 22:35:09 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-01-19 22:37:25 +0000 kqueue(2): Add note about format of the data for NOTE_EXIT Noted by: Dave Baukus <daveb@spectralogic.com> PR: 261346 MFC after: 3 days Sponsored by: The FreeBSD Foundation lib/libc/sys/kqueue.2 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=7a6364ac7733bb3225285cdbd3119d124a56a802 commit 7a6364ac7733bb3225285cdbd3119d124a56a802 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-01-19 22:35:09 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-01-22 00:50:23 +0000 kqueue(2): Add note about format of the data for NOTE_EXIT PR: 261346 (cherry picked from commit 7406ec4ea99c1c61e88d5c98c58094093b9e78fb) lib/libc/sys/kqueue.2 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)