-
Notifications
You must be signed in to change notification settings - Fork 679
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
Implemented all std::os::fd
traits for mqueue::MqdT
.
#2097
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only for Linux? Are you sure these traits shouldn't apply more widely?
I don't have any reason to artificially limit it, as I mentioned originally it was based on my working knowledge of the At its broadest, the API could be enabled for all unix per the Rust standard lib (see below for exceptions): // unix
#[cfg(not(all(
doc,
any(
all(target_arch = "wasm32", not(target_os = "wasi")),
all(target_vendor = "fortanix", target_env = "sgx")
)
)))]
#[cfg(target_os = "hermit")]
#[path = "hermit/mod.rs"]
pub mod unix;
#[cfg(not(all(
doc,
any(
all(target_arch = "wasm32", not(target_os = "wasi")),
all(target_vendor = "fortanix", target_env = "sgx")
)
)))]
#[cfg(all(not(target_os = "hermit"), any(unix, doc)))]
pub mod unix; However, there appear to be 2 libc families which would not satisfy the type guarantees1: Footnotes |
Man pages suggest that select and poll are supported for message queues on NetBSD and DragonflyBSD. I'm very surprised to see that libc doesn't even define mq_open on Android, so we can't do it there. On FreeBSD select and poll are supported but through a different mechanism: one must first use mq_getfd_np to get the file descriptor. So I think you should enable this for Linux, NetBSD, and DragonflyBSD. |
I'm slightly concerned the |
I think you read that wrong. The |
Since linux allows polling message queues 1, these changes enable that use case. Targeted to
linux
, since it was the only one I was able to confirm 2.Footnotes
mq_overview(7) ↩
https://elixir.bootlin.com/linux/latest/source/ipc/mqueue.c#L908 ↩