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 CMSG macros for unix/bsd and unix/notbsd #1098

Merged
merged 1 commit into from
Oct 29, 2018
Merged

Add CMSG macros for unix/bsd and unix/notbsd #1098

merged 1 commit into from
Oct 29, 2018

Conversation

andrewtj
Copy link
Contributor

This adds the "Ancillary Data Object Macros" from RFC 2292. My C's weak but I think I've translated them faithfully. Tested on macOS and Linux/glibc.

@rust-highfive
Copy link

r? @alexcrichton

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

@andrewtj
Copy link
Contributor Author

Any feedback?

@alexcrichton
Copy link
Member

Thanks for the PR and sorry for the delay! These look good to me though, thanks!

@bors: r+

@bors
Copy link
Contributor

bors commented Oct 29, 2018

📌 Commit 2701f62 has been approved by alexcrichton

bors added a commit that referenced this pull request Oct 29, 2018
Add CMSG macros for unix/bsd and unix/notbsd

This adds the ["Ancillary Data Object Macros" from RFC 2292](https://tools.ietf.org/html/rfc2292#section-4.3). My C's weak but I think I've translated them faithfully. Tested on macOS and Linux/glibc.
@bors
Copy link
Contributor

bors commented Oct 29, 2018

⌛ Testing commit 2701f62 with merge c2f6c44...

if (*mhdr).msg_controllen as usize >= mem::size_of::<cmsghdr>() {
(*mhdr).msg_control as *mut cmsghdr
} else {
0 as *mut cmsghdr
Copy link
Contributor

@gnzlbg gnzlbg Oct 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: use ptr::null() here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed the crate's convention was to not use that (it's not used anywhere that I've seen)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duh, indeed, libc might predate https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#zero_ptr we can always do a cargo fix for these later

@bors
Copy link
Contributor

bors commented Oct 29, 2018

💥 Test timed out

@gnzlbg
Copy link
Contributor

gnzlbg commented Oct 29, 2018

@bors: r+

@bors
Copy link
Contributor

bors commented Oct 29, 2018

@gnzlbg: 🔑 Insufficient privileges: Not in reviewers

@gnzlbg
Copy link
Contributor

gnzlbg commented Oct 29, 2018

r? me

@alexcrichton
Copy link
Member

@bors: retry

@bors
Copy link
Contributor

bors commented Oct 29, 2018

⌛ Testing commit 2701f62 with merge 04a13d1...

bors added a commit that referenced this pull request Oct 29, 2018
Add CMSG macros for unix/bsd and unix/notbsd

This adds the ["Ancillary Data Object Macros" from RFC 2292](https://tools.ietf.org/html/rfc2292#section-4.3). My C's weak but I think I've translated them faithfully. Tested on macOS and Linux/glibc.
@bors
Copy link
Contributor

bors commented Oct 29, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 04a13d1 to master...

@bors bors merged commit 2701f62 into rust-lang:master Oct 29, 2018
@andrewtj
Copy link
Contributor Author

@alexcrichton thanks!

asomers added a commit to asomers/libc that referenced this pull request Jan 15, 2019
PR rust-lang#1098 added the CMSG_DATA(3) family of functions into libc.  Because
they're defined as macros in C, they had to be rewritten as Rust
functions for libc.  Also, they can't be tested in CI for the same
reason.  But that PR erroneously used the same definitions in BSD as in
Linux.

This commit corrects the definitions for OSX, FreeBSD, DragonflyBSD,
OpenBSD, and NetBSD.  I renamed a few variables and collapsed a few
macros in order to combine the definitions where possible.

Fixes rust-lang#1210
asomers added a commit to asomers/libc that referenced this pull request Jan 16, 2019
PR rust-lang#1098 added the CMSG_DATA(3) family of functions into libc.  Because
they're defined as macros in C, they had to be rewritten as Rust
functions for libc.  Also, they can't be tested in CI for the same
reason.  But that PR erroneously used the same definitions in BSD as in
Linux.

This commit corrects the definitions for OSX, FreeBSD, DragonflyBSD,
OpenBSD, and NetBSD.  I renamed a few variables and collapsed a few
macros in order to combine the definitions where possible.

Fixes rust-lang#1210
bors added a commit that referenced this pull request Jan 17, 2019
Fix CMSG_DATA(3) and friends on BSD

PR #1098 added the CMSG_DATA(3) family of functions into libc.  Because
they're defined as macros in C, they had to be rewritten as Rust
functions for libc.  Also, they can't be tested in CI for the same
reason.  But that PR erroneously used the same definitions in BSD as in
Linux.

This commit corrects the definitions for OSX, FreeBSD, DragonflyBSD,
OpenBSD, and NetBSD.  I renamed a few variables and collapsed a few
macros in order to combine the definitions where possible.

Fixes #1210
asomers added a commit to asomers/libc that referenced this pull request Jan 31, 2019
This is an error from PR rust-lang#1098.  The wrong definition coincidentally
works on Linux/glibc, but it fails on Linux/musl.
asomers added a commit to asomers/libc that referenced this pull request Jan 31, 2019
This is an error from PR rust-lang#1098.  The wrong definitions coincidentally
work on Linux/glibc, but fail on Linux/musl.

fixup
asomers added a commit to asomers/libc that referenced this pull request Jan 31, 2019
This is an error from PR rust-lang#1098.  The wrong definitions coincidentally
work on Linux/glibc, but fail on Linux/musl.
asomers added a commit to asomers/libc that referenced this pull request Feb 1, 2019
This is an error from PR rust-lang#1098.  The wrong definitions coincidentally
work on Linux/glibc, but fail on Linux/musl.
asomers added a commit to asomers/libc that referenced this pull request Feb 1, 2019
This is an error from PR rust-lang#1098.  The wrong definitions coincidentally
work on Linux/glibc, but fail on Linux/musl.
asomers added a commit to asomers/libc that referenced this pull request Feb 5, 2019
This is an error from PR rust-lang#1098.  The wrong definitions coincidentally
work on Linux/glibc, but fail on Linux/musl.
bors added a commit that referenced this pull request Feb 5, 2019
Fix cmsg(3) bugs for musl and OSX

This PR fixes bugs in the cmsg(3) family of functions for Linux/musl and OSX, introduced by PR #1098 and PR #1212 .  It also adds an integration test which hopefully will validate these functions on every platform.
bors added a commit that referenced this pull request Feb 5, 2019
Fix cmsg(3) bugs for musl and OSX

This PR fixes bugs in the cmsg(3) family of functions for Linux/musl and OSX, introduced by PR #1098 and PR #1212 .  It also adds an integration test which hopefully will validate these functions on every platform.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants