-
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
Added getters for the MqAttr struct #1619
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.
Thanks for the PR! Can you update the changelog to include these changes?
I actually ran into the absence of these fields while looking into a failing test on DragonFly (and presumably NetBSD), so this change will also help clean up some tests in the future!
src/mqueue.rs
Outdated
/// The number of messages currently held in the queue | ||
pub const fn current_msg(&self) -> mq_attr_member_t { | ||
self.mq_attr.mq_curmsgs | ||
} |
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.
I'm not sure how I feel about the naming here. cur
is expanded to current
, but we don't expand msg
, and the underscores aren't present in the libc
definitions.
For consistency with the rest of nix (example below), I'd lean towards using the same names as the underlying fields, minus the mq_
prefix. @asomers thoughts?
Lines 1270 to 1273 in a392647
/// Packet type | |
pub fn pkttype(&self) -> u8 { | |
self.0.sll_pkttype | |
} |
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.
I'm good with that. Seems more consistent. I can fix it.
LGTM. Just squash your commits and I'll merge it. |
9b03b01
to
80f447b
Compare
bors r+ |
With the existing code, if you call
mq_getattr()
, there does not appear to be a way to get any of the attributes from the returnedMqAttr
struct, other than the flags. This adds getter functions to retrieve the size parameters of the queue, and the current number of messages in the queue.