Skip to content
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

Add types for inspecting control messages in Unix socket ancillary data #117196

Closed
wants to merge 1 commit into from

Conversation

jmillikin
Copy link
Contributor

@jmillikin jmillikin commented Oct 26, 2023

Tracking issue: #76915

RFC for unix_socket_ancillary_data redesign: rust-lang/rfcs#3430

The portion of the new API dealing with control message inspection seems to be non-contentious, so this PR implements it. The types and logic are all separate from the current implementation, so they can co-exist without worries about compatibility or unexpected behavior changes.

New types:

  • ControlMessage<'a> is a borrowed reference to a single control message. No inspection of the message content, just the generic metadata (cmsg_level, cmsg_type) and data slice.
  • &ControlMessages is a wrapper around &[u8] that has an iter() -> ControlMessagesIter method.
  • ControlMessagesIter<'a> iterates over control messages by inspecting cmsg_len

Includes docs and tests.

@rustbot
Copy link
Collaborator

rustbot commented Oct 26, 2023

r? @cuviper

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 26, 2023
@rust-log-analyzer

This comment has been minimized.

@jmillikin jmillikin force-pushed the unix-ancillary-data branch 2 times, most recently from 15d4daf to f50a22f Compare October 26, 2023 02:04
@jmillikin
Copy link
Contributor Author

@rustbot label +T-libs-api -T-libs

@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 26, 2023
@cuviper
Copy link
Member

cuviper commented Oct 26, 2023

r? libs-api

@rustbot rustbot assigned dtolnay and unassigned cuviper Oct 26, 2023
@rust-log-analyzer

This comment has been minimized.

@dtolnay
Copy link
Member

dtolnay commented Oct 26, 2023

Reassigning to Josh, who has opinions about the existing ancillary data API and the proposed one.

r? joshtriplett

@rustbot rustbot assigned joshtriplett and unassigned dtolnay Oct 26, 2023
@jmillikin jmillikin force-pushed the unix-ancillary-data branch 2 times, most recently from 1cdcf8a to fc50372 Compare October 26, 2023 02:53
@jmillikin
Copy link
Contributor Author

CI is green now (having done its job of reminding me that UI tests exist...)

@jmillikin
Copy link
Contributor Author

Note: the most recent iteration of the RFC doesn't require ControlMessagesBuf, so I've removed it from this PR.

@joshtriplett
Copy link
Member

r? libs-api

@rustbot rustbot assigned Amanieu and unassigned joshtriplett Feb 11, 2024
@jmillikin jmillikin closed this Jun 9, 2024
@jmillikin jmillikin deleted the unix-ancillary-data branch June 9, 2024 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants