Added getters for the MqAttr struct#1619
Conversation
rtzoeller
left a comment
There was a problem hiding this comment.
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!
| /// 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.
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
There was a problem hiding this comment.
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 returnedMqAttrstruct, 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.