-
Notifications
You must be signed in to change notification settings - Fork 692
Add support for sendmsg(2), recvmsg(2), and cmsg(4) #179
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
Conversation
I'm pretty open to review of the approach here; there are a couple of different ways you could go for exposing safe wrappers on The function It looks like at least some tests are failing because Rust 1.0.0 is stricter about Sized... if compatibility with 1.0 is important, I can try to rework things. I'm running 1.1.0 locally and it's fine. |
I'm OK w/ bumping to 1.1.0. Feel free to update your PR w/ the .travis.yml change. |
Oh oh.. still not passing CI :) |
Fixed and rebased on top of master. I was using I wish we had a better way to test these sorts of things, but for an API this gnarly (mostly C preprocessor macros), running it and seeing if it works may be the best option. |
The best specification for control message layout appears to be [RFC 2292, section 4](https://tools.ietf.org/html/rfc2292#section-4), despite this not being a wire protocol. These definitions have also been checked against glibc 2.19 <bits/socket.h> and Linux 4.0 <linux/socket.h>, and tested on Debian 8.1 and FreeBSD 10.2 x86_64. The API differs a bit from the cmsg(4) API for type-safety reasons (and also because the cmsg(4) API is terrible). See test/sys/test_socket.rs for an example. Only supports SCM_RIGHTS at the moment. Fixes nix-rust#88.
Thanks! |
I had to revert (5948204) this. It looks like the commit caused some memory problems (made evident by jemalloc hanging in some cases). I ran valgrind, here is the relevant output:
|
Bizarre! I can reproduce this in valgrind, let me see what I did wrong. |
@carllerche, are you easily able to test/reproduce this this? Can you try cherry-picking geofft/nix-rust@1574408 and seeing if it avoids the problem you see? (My OS X access at the moment is limited, so if you can reproduce both the valgrind problem and the hang reliably, that would be helpful to me.) It does clear up a similar valgrind warning on Linux, but I think there were two mistakes in this PR (both fixed in that commit), and I think Linux was only running into one of them. |
I got an OS X valgrind and tested the patch, and it in fact eliminates the valgrind error. Resubmitted as #197. |
The best specification for control message layout appears to be RFC 2292, section 4, despite this not being a wire protocol. These definitions have also been checked against glibc 2.19 <bits/socket.h> and Linux 4.0 <linux/socket.h>, and tested on Debian 8.1 and FreeBSD 10.2 x86_64.
The API differs a bit from the cmsg(4) API for type-safety reasons (and also because the cmsg(4) API is terrible). See test/sys/test_socket.rs for an example.
Only supports SCM_RIGHTS at the moment.
Fixes #88.