-
Notifications
You must be signed in to change notification settings - Fork 674
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
Support for OpenBSD #688
Support for OpenBSD #688
Changes from all commits
836c06d
0874cfa
000366c
6ea77da
0fbd223
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,12 @@ | |
|
||
pub use libc::{socket, listen, bind, accept, connect, setsockopt, sendto, recvfrom, getsockname, getpeername, recv, send}; | ||
|
||
use libc::{c_int, c_void, socklen_t, size_t, ssize_t}; | ||
use libc::{c_int, c_void, socklen_t, ssize_t}; | ||
|
||
#[cfg(target_os = "macos")] | ||
#[cfg(not(target_os = "macos"))] | ||
use libc::size_t; | ||
|
||
#[cfg(not(target_os = "linux"))] | ||
use libc::c_uint; | ||
|
||
use sys::uio::IoVec; | ||
|
@@ -23,19 +26,27 @@ pub type type_of_cmsg_data = c_uint; | |
#[cfg(not(target_os = "macos"))] | ||
pub type type_of_cmsg_data = size_t; | ||
|
||
#[cfg(target_os = "linux")] | ||
pub type type_of_msg_iovlen = size_t; | ||
|
||
#[cfg(not(target_os = "linux"))] | ||
pub type type_of_msg_iovlen = c_uint; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should only be one empty line following this. |
||
// Private because we don't expose any external functions that operate | ||
// directly on this type; we just use it internally at FFI boundaries. | ||
// Note that in some cases we store pointers in *const fields that the | ||
// kernel will proceed to mutate, so users should be careful about the | ||
// actual mutability of data pointed to by this structure. | ||
// | ||
// FIXME: Replace these structs with the ones defined in libc | ||
#[repr(C)] | ||
pub struct msghdr<'a> { | ||
pub msg_name: *const c_void, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This struct should be replaced with the FFI types declared in libc, but that doesn't need to be done for this PR. Please add a FIXME stating that. |
||
pub msg_namelen: socklen_t, | ||
pub msg_iov: *const IoVec<&'a [u8]>, | ||
pub msg_iovlen: size_t, | ||
pub msg_iovlen: type_of_msg_iovlen, | ||
pub msg_control: *const c_void, | ||
pub msg_controllen: size_t, | ||
pub msg_controllen: type_of_cmsg_len, | ||
pub msg_flags: c_int, | ||
} | ||
|
||
|
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.
You can revert the changes to this file. This file has been obsolete ever since most constants moved into libc. libc has its own, superior version.
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 added these to get the errno tests passing. It looks like the check_errno macro uses them via assert_const_eq or did I miss something?
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.
Grr, I thought we had already removed that. Go ahead and leave these changes in for now; we'll delete them in a future PR.
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.
As we do conversions of our code to use upstream libc values, we can remove these tests incrementally until they're all gone. But for now, we should add these tests if we have any hard-coded values (like all the
errno
values currently are).