Add Linux-specific recvmmsg(2) and sendmmsg(2)

There is a compatibility issue regarding the type of a flag parameter:
int vs uint. Linux does declare the syscall to use uint and musl
followed it, but it is incompatible with other POSIX recv*/send*
syscalls. So it seems to be wise to follow the glibc version of
prototypes with int.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
This commit is contained in:
NODA, Kai 2016-04-10 22:21:55 +08:00 committed by Julian Squires
parent 5257dd8cc0
commit 61c23fb927
No known key found for this signature in database
GPG Key ID: 2F3C2458C889AAD7
2 changed files with 17 additions and 0 deletions

View File

@ -404,6 +404,11 @@ fn main() {
"prlimit" | "prlimit64" | // non-int in 2nd arg
"strerror_r" if linux => true, // actually xpg-something-or-other
// int vs uint. Sorry musl, your prototype declarations are "correct" in the sense that
// they match the interface defined by Linux verbatim, but they conflict with other
// send*/recv* syscalls
"sendmmsg" | "recvmmsg" if musl => true,
// typed 2nd arg on linux and android
"gettimeofday" if linux || android || freebsd || openbsd || dragonfly => true,

View File

@ -220,6 +220,11 @@ s! {
pub msgtql: ::c_int,
pub msgseg: ::c_ushort,
}
pub struct mmsghdr {
pub msg_hdr: ::msghdr,
pub msg_len: ::c_uint,
}
}
pub const ABDAY_1: ::nl_item = 0x20000;
@ -983,6 +988,13 @@ extern {
-> ::ssize_t;
}
extern {
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;
}
cfg_if! {
if #[cfg(any(target_env = "musl",
target_os = "fuchsia",