Conversation
asomers
commented
Dec 13, 2022
- Prefer methods instead of functions.
- Create a newtype for a kqueue.
- Document everything.
- Deprecate EVFILT_SENDFILE, because it was never fully implemented upstream.
- Add support to the libc_enum! macro to be able to deprecate variants.
| EVFILT_LIO, | ||
| #[cfg(any(target_os = "ios", target_os = "macos"))] | ||
| /// Mach portsets | ||
| EVFILT_MACHPORT, |
There was a problem hiding this comment.
This part may be unsound; I'm not sure about mach port support here but it might not be just an FD.
There was a problem hiding this comment.
What might not just be an FD? And what part might be unsound? This just defines the filter constant.
| impl Kqueue { | ||
| /// Create a new kernel event queue. | ||
| pub fn new() -> Result<Self> { | ||
| let res = unsafe { libc::kqueue() }; |
There was a problem hiding this comment.
Is there a plan to support the kqueue1() function exposed by FreeBSD?
There was a problem hiding this comment.
Do you mean NetBSD? No. I don't know of anybody who needs it, and we don't have a dedicated NetBSD maintainer.
| use std::ptr; | ||
|
|
||
| // Redefine kevent in terms of programmer-friendly enums and bitfields. | ||
| /// A Kernel event queue. Used to notify a process of various asynchronous |
There was a problem hiding this comment.
Nit.
| /// A Kernel event queue. Used to notify a process of various asynchronous | |
| /// A kernel event queue. Used to notify a process of various asynchronous |
| } | ||
|
|
||
| /// Modify an existing [`KEvent`]. | ||
| // Probably should deprecate. Would anybody ever use it over `KEvent::new`? |
There was a problem hiding this comment.
I think deprecating it makes sense. If there is a use case I expect we'll hear about it after marking it as deprecated - we can always remove the deprecation label and keep it around if a use case does come up.
| #[cfg(any(target_os = "macos", target_os = "ios"))] | ||
| #[allow(missing_docs)] | ||
| NOTE_VM_PRESSURE_TERMINATE; | ||
| #[allow(missing_docs)] |
There was a problem hiding this comment.
If we find ourselves sprinkling #[allow(missing_docs)] over every attribute like this in other structs, we might consider modifying the libc_bitflags macro to make it less tedious.
rtzoeller
left a comment
There was a problem hiding this comment.
Approved with some minor feedback. Don't forget to update the CHANGELOG PR #.
* Prefer methods instead of functions. * Create a newtype for a kqueue. * Document everything. * Deprecate EVFILT_SENDFILE, because it was never fully implemented upstream. * Add support to the libc_enum! macro to be able to deprecate variants.
|
bors r=rtzoeller |