-
Notifications
You must be signed in to change notification settings - Fork 666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: expose the inner fd of Kqueue #2258
Conversation
I think this PR is probably ok. But I still don't understand @eesekaj's use case. It sounds like he wants to close the file descriptor without dropping the Kqueue, which is very unsafe. |
Calling close() on a file descriptor will remove any kevents that reference the descriptor. There is no way to drop Kqueue in kernel form userland. And I don't need the instance Kqueue which is created by nix crate, because we have our own abstraction above raw FD and FD is used to identify the instance. If I extract FD from Kqueue, in this case the Kqueu should be consumed and dropped automatically. But in previous implementation, it was made private and no way to even read the FD number. |
Are you aware that dropping the
If you have your own abstraction anyway and don't use our |
Should we merge this? |
I think your PR is reasonable. The only troubling part is @eesekaj 's explanation for why he wanted it. He never did fully explain it. I think he was trying to close the kqueue, and didn't understand that closing it happens automatically on drop. |
Maybe that usage is very specific to their project, and they switched to the libc crate |
What does this PR do
The author of #2183 wants to use the inner fd to identify a Kqueue instance, this PR implements it, so closes #2183
Should we do
impl AsRawFd
for it as well, I don't have any strong view over this, but if we have made decision on this, we should do it to all the I/O-safe typesChecklist:
CONTRIBUTING.md