Skip to content

Commit

Permalink
Auto merge of #1231 - dholroyd:mmsg-support, r=gnzlbg
Browse files Browse the repository at this point in the history
Broader sendmmsg() / recvmmsg() support

As a prerequisite for getting `sendmmsg()` / `recvmmsg()` into nix ( nix-rust/nix#1017 ), support for non-linux platforms needs to be added in libc.

The initial commits in this PR will just be to test out target support via CI.
  • Loading branch information
bors committed Feb 4, 2019
2 parents 1f63b26 + 0d3a600 commit 8ac9573
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 14 deletions.
10 changes: 10 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ s! {
pub ss_size: ::size_t,
pub ss_flags: ::c_int,
}

pub struct mmsghdr {
pub msg_hdr: ::msghdr,
pub msg_len: ::ssize_t,
}
}

pub const SIGEV_THREAD_ID: ::c_int = 4;
Expand Down Expand Up @@ -1199,6 +1204,11 @@ extern {

pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
pub fn __xuname(nmln: ::c_int, buf: *mut ::c_void) -> ::c_int;

pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::size_t,
flags: ::c_int) -> ::ssize_t;
pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::size_t,
flags: ::c_int, timeout: *const ::timespec) -> ::ssize_t;
}

#[link(name = "util")]
Expand Down
10 changes: 10 additions & 0 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ s! {
pub ar_pln: u8,
pub ar_op: u16,
}

pub struct mmsghdr {
pub msg_hdr: ::msghdr,
pub msg_len: ::c_uint,
}
}

pub const AT_FDCWD: ::c_int = -100;
Expand Down Expand Up @@ -1199,6 +1204,11 @@ extern {
pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;

pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;

pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint,
flags: ::c_int) -> ::c_int;
pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint,
flags: ::c_int, timeout: *mut ::timespec) -> ::c_int;
}

#[link(name = "util")]
Expand Down
4 changes: 4 additions & 0 deletions src/unix/notbsd/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,10 @@ extern {
f: extern fn(*mut ::c_void) -> *mut ::c_void,
value: *mut ::c_void) -> ::c_int;
pub fn __errno() -> *mut ::c_int;
pub fn sendmmsg(sockfd: ::c_int, msgvec: *const ::mmsghdr, vlen: ::c_uint,
flags: ::c_int) -> ::c_int;
pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint,
flags: ::c_int, timeout: *const ::timespec) -> ::c_int;
}

cfg_if! {
Expand Down
9 changes: 2 additions & 7 deletions src/unix/notbsd/emscripten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,6 @@ s! {
pub msgseg: ::c_ushort,
}

pub struct mmsghdr {
pub msg_hdr: ::msghdr,
pub msg_len: ::c_uint,
}

pub struct sembuf {
pub sem_num: ::c_ushort,
pub sem_op: ::c_short,
Expand Down Expand Up @@ -1666,9 +1661,9 @@ extern {

pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint,
flags: ::c_int) -> ::c_int;
pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint,
flags: ::c_int, timeout: *mut ::timespec) -> ::c_int;
pub fn sync();
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
Expand Down
9 changes: 2 additions & 7 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,6 @@ s! {
pub msgseg: ::c_ushort,
}

pub struct mmsghdr {
pub msg_hdr: ::msghdr,
pub msg_len: ::c_uint,
}

pub struct sembuf {
pub sem_num: ::c_ushort,
pub sem_op: ::c_short,
Expand Down Expand Up @@ -2054,9 +2049,9 @@ extern {
pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn vhangup() -> ::c_int;
pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint,
flags: ::c_int) -> ::c_int;
pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint,
flags: ::c_int, timeout: *mut ::timespec) -> ::c_int;
pub fn sync();
pub fn syscall(num: ::c_long, ...) -> ::c_long;
Expand Down
5 changes: 5 additions & 0 deletions src/unix/notbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ s! {
pub ar_pln: u8,
pub ar_op: u16,
}

pub struct mmsghdr {
pub msg_hdr: ::msghdr,
pub msg_len: ::c_uint,
}
}

// intentionally not public, only used for fd_set
Expand Down

0 comments on commit 8ac9573

Please sign in to comment.