Skip to content

Commit fd9d460

Browse files
committed
Auto merge of #589 - tokenrove:recvmmsg-sendmmsg, r=alexcrichton
Add Linux-specific recvmmsg(2) and sendmmsg(2) This is just the patch that @nodakai submitted in #257, updated against current master, but I'm opening this PR as a vehicle for whatever additional changes need to be made to get it merged. Thanks.
2 parents 5257dd8 + 61c23fb commit fd9d460

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

libc-test/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ fn main() {
404404
"prlimit" | "prlimit64" | // non-int in 2nd arg
405405
"strerror_r" if linux => true, // actually xpg-something-or-other
406406

407+
// int vs uint. Sorry musl, your prototype declarations are "correct" in the sense that
408+
// they match the interface defined by Linux verbatim, but they conflict with other
409+
// send*/recv* syscalls
410+
"sendmmsg" | "recvmmsg" if musl => true,
411+
407412
// typed 2nd arg on linux and android
408413
"gettimeofday" if linux || android || freebsd || openbsd || dragonfly => true,
409414

src/unix/notbsd/linux/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ s! {
220220
pub msgtql: ::c_int,
221221
pub msgseg: ::c_ushort,
222222
}
223+
224+
pub struct mmsghdr {
225+
pub msg_hdr: ::msghdr,
226+
pub msg_len: ::c_uint,
227+
}
223228
}
224229

225230
pub const ABDAY_1: ::nl_item = 0x20000;
@@ -983,6 +988,13 @@ extern {
983988
-> ::ssize_t;
984989
}
985990

991+
extern {
992+
pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
993+
flags: ::c_int) -> ::c_int;
994+
pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
995+
flags: ::c_int, timeout: *mut ::timespec) -> ::c_int;
996+
}
997+
986998
cfg_if! {
987999
if #[cfg(any(target_env = "musl",
9881000
target_os = "fuchsia",

0 commit comments

Comments
 (0)