Page MenuHomeFreeBSD

Add kqueue1(2) syscall
ClosedPublic

Authored by kib on Mar 26 2023, 12:43 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 10:12 PM
Unknown Object (File)
Fri, Nov 1, 2:58 AM
Unknown Object (File)
Mon, Oct 21, 3:20 PM
Unknown Object (File)
Mon, Oct 14, 8:59 AM
Unknown Object (File)
Oct 3 2024, 9:53 PM
Unknown Object (File)
Oct 2 2024, 10:40 AM
Unknown Object (File)
Sep 27 2024, 5:12 AM
Unknown Object (File)
Sep 26 2024, 11:46 AM
Subscribers

Details

Summary

It adds an ability to atomically set O_CLOEXEC on the new kqueue descriptor.
I noted that something like this is missing during read of tokio-rs/mio kqueue implementation.

The naming is chosen to follow dup3()/accept4() pattern.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Mar 26 2023, 12:43 AM

I would maybe suggest KQ_CLOEXEC or KQUEUE_CLOEXEC as the flag name. In particular, if we ever needed kqueue2 in the future for some reason it would likely also still accept the flags argument and then the current name would be a bit odd. I think one of those names more closely matches SOCK_NONBLOCK and SOCK_CLOEXEC used with accept4.

This revision is now accepted and ready to land.Mar 27 2023, 5:53 PM

agree w/ @jhb on the flag name. I've also assumed that 2 is the first "version suffix" used, that kqueue is implicitly "kqueue1" , like dup, dup2, dup3. Was there ever a dup1 that has since been removed?

Other than quibbling over naming the change looks good to me

agree w/ @jhb on the flag name. I've also assumed that 2 is the first "version suffix" used, that kqueue is implicitly "kqueue1" , like dup, dup2, dup3. Was there ever a dup1 that has since been removed?

Other than quibbling over naming the change looks good to me

The number is the number of arguments, for the "new style" like dup3, pipe2, and accept4. dup2 pre-dates that scheme, but kqueue1 is consistent with the number-of-arguments suffix scheme.

dup(2) dates to the earliest days of Unix. It's present in V6, but dup2(2) doesn't appear until V7. If there ever was a dup1, no vestige of it survived in the Unix line.

Name quibbling and way-back-machine operation aside, the code looks fine. I generally agree with john and ed on naming issues they've raised.

Huh, learned something new today. In that case I'd just echo John's comment on the KQ1 flag prefix.

This revision now requires review to proceed.Mar 27 2023, 9:05 PM
jhb added inline comments.
lib/libc/sys/kqueue.2
99

Wording suggestion borrowed from pipe2(2).

This revision is now accepted and ready to land.Mar 27 2023, 9:25 PM
kib marked an inline comment as done.Mar 27 2023, 10:09 PM
This revision was automatically updated to reflect the committed changes.