From bc224d976b5b51a200412600e7f1412eabefd891 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 09:17:32 +0000 Subject: [PATCH 01/16] Hoist {send,recv}mmsg() to test target support Will likely alter this after seeing CI results across platforms. --- src/unix/bsd/freebsdlike/mod.rs | 5 +++++ src/unix/bsd/mod.rs | 5 +++++ src/unix/bsd/netbsdlike/mod.rs | 5 +++++ src/unix/notbsd/android/mod.rs | 5 +++++ src/unix/notbsd/linux/mod.rs | 9 --------- src/unix/notbsd/mod.rs | 9 +++++++++ 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index ca9ed982be5fa..969fb228b98d5 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -186,6 +186,11 @@ s! { pub ar_pln: u8, pub ar_op: u16, } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_ssize_t, + } } s_no_extra_traits! { diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 8b5ec8c54d766..c2031e6d864b9 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -594,6 +594,11 @@ extern { pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; + 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; + pub fn sync(); #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] pub fn getgrgid_r(uid: ::uid_t, diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index d03529662faa4..e9d6506c59a53 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -61,6 +61,11 @@ s! { pub l_type: ::c_short, pub l_whence: ::c_short, } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_uint, + } } pub const D_T_FMT: ::nl_item = 0; diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index 2213b75b663ed..1f6438156037d 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -51,6 +51,11 @@ s! { pub cmsg_type: ::c_int, } + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_uint, + } + pub struct termios { pub c_iflag: ::tcflag_t, pub c_oflag: ::tcflag_t, diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 03192e6278e3d..614fedd21bdc2 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -191,11 +191,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, @@ -2082,10 +2077,6 @@ 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, - 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; pub fn sync(); pub fn syscall(num: ::c_long, ...) -> ::c_long; pub fn sched_getaffinity(pid: ::pid_t, diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index baabd6e84dadd..663b902c5e158 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -209,6 +209,11 @@ s! { pub ar_pln: u8, pub ar_op: u16, } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_uint, + } } s_no_extra_traits!{ @@ -1373,6 +1378,10 @@ extern { flags: ::c_int) -> ::ssize_t; pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; + 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; pub fn uname(buf: *mut ::utsname) -> ::c_int; } From 0b14c2cfafa02b7d3daea3c689f8b990b8e8ece7 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 10:03:06 +0000 Subject: [PATCH 02/16] Not available on macos I think --- src/unix/bsd/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index c2031e6d864b9..0b8ac3a630bb4 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -594,8 +594,10 @@ extern { pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; + #[cfg(not(target_os = "macos"))] pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint, flags: ::c_int) -> ::c_int; + #[cfg(not(target_os = "macos"))] pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint, flags: ::c_int, timeout: *mut ::timespec) -> ::c_int; From 8fe9d252b04107566305dfc2c83e42923a5a3587 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 10:05:32 +0000 Subject: [PATCH 03/16] Qualify type names --- src/unix/bsd/mod.rs | 4 ++-- src/unix/notbsd/mod.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 0b8ac3a630bb4..cc7b186fed5fd 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -595,10 +595,10 @@ extern { -> ::ssize_t; #[cfg(not(target_os = "macos"))] - 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; #[cfg(not(target_os = "macos"))] - 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(); diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index 663b902c5e158..d3402e90169a6 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -1378,9 +1378,9 @@ extern { flags: ::c_int) -> ::ssize_t; pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; - 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 uname(buf: *mut ::utsname) -> ::c_int; } From 4036d6cb982216cba680cec4d28550563cc5bcfb Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 10:06:16 +0000 Subject: [PATCH 04/16] mmsghdr pointer is const in android I think --- src/unix/notbsd/android/mod.rs | 2 ++ src/unix/notbsd/linux/mod.rs | 2 ++ src/unix/notbsd/mod.rs | 2 -- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index 1f6438156037d..58b758dd30b6e 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -1955,6 +1955,8 @@ 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; } cfg_if! { diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 614fedd21bdc2..7da7dcf5f6909 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -2077,6 +2077,8 @@ 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, + flags: ::c_int) -> ::c_int; pub fn sync(); pub fn syscall(num: ::c_long, ...) -> ::c_long; pub fn sched_getaffinity(pid: ::pid_t, diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index d3402e90169a6..89d055b1c7f18 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -1378,8 +1378,6 @@ extern { flags: ::c_int) -> ::ssize_t; pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; - 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; pub fn uname(buf: *mut ::utsname) -> ::c_int; From eff3d811383637bfb68d832cd19b1709337fe8a4 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 10:21:53 +0000 Subject: [PATCH 05/16] Fix wrong C type name --- src/unix/bsd/freebsdlike/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 969fb228b98d5..36514b2ee60ec 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -189,7 +189,7 @@ s! { pub struct mmsghdr { pub msg_hdr: ::msghdr, - pub msg_len: ::c_ssize_t, + pub msg_len: ::ssize_t, } } From 91639b6bc8b38d7b184ccd1eecdf2ae7f856c7e6 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 10:24:33 +0000 Subject: [PATCH 06/16] Use cfg_attr like other items --- src/unix/bsd/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index cc7b186fed5fd..d5604b1deb866 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -594,10 +594,10 @@ extern { pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; - #[cfg(not(target_os = "macos"))] + #[cfg_attr(not(target_os = "macos"))] pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, flags: ::c_int) -> ::c_int; - #[cfg(not(target_os = "macos"))] + #[cfg_attr(not(target_os = "macos"))] pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, flags: ::c_int, timeout: *mut ::timespec) -> ::c_int; From a4c25a99e4eb13d08922a2ef13660ed52000d6c8 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 10:34:01 +0000 Subject: [PATCH 07/16] Push definitions down a level to avoid macos I guess the previous lint failure was about avoiding #[cfg], and doing this instead. --- src/unix/bsd/freebsdlike/mod.rs | 4 ++++ src/unix/bsd/mod.rs | 7 ------- src/unix/bsd/netbsdlike/mod.rs | 4 ++++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 36514b2ee60ec..980bf3d1c1ff2 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1245,6 +1245,10 @@ extern { pub fn uselocale(loc: ::locale_t) -> ::locale_t; pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, times: *const ::timespec, flag: ::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")] diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index d5604b1deb866..8b5ec8c54d766 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -594,13 +594,6 @@ extern { pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; - #[cfg_attr(not(target_os = "macos"))] - pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, - flags: ::c_int) -> ::c_int; - #[cfg_attr(not(target_os = "macos"))] - pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, - flags: ::c_int, timeout: *mut ::timespec) -> ::c_int; - pub fn sync(); #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] pub fn getgrgid_r(uid: ::uid_t, diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index e9d6506c59a53..22b2570c21367 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -719,6 +719,10 @@ 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 uname(buf: *mut ::utsname) -> ::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; } cfg_if! { From d26c2ab8c2c3c8a7765acc95f30926dea09af7c8 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 10:45:37 +0000 Subject: [PATCH 08/16] timespec pointer also const on andriod --- src/unix/notbsd/android/mod.rs | 2 ++ src/unix/notbsd/linux/mod.rs | 2 ++ src/unix/notbsd/mod.rs | 2 -- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index 58b758dd30b6e..c7eefceec6ace 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -1957,6 +1957,8 @@ extern { 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! { diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 7da7dcf5f6909..8abe76135d9a0 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -2079,6 +2079,8 @@ extern { pub fn vhangup() -> ::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; pub fn sync(); pub fn syscall(num: ::c_long, ...) -> ::c_long; pub fn sched_getaffinity(pid: ::pid_t, diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index 89d055b1c7f18..4394889256a4d 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -1378,8 +1378,6 @@ extern { flags: ::c_int) -> ::ssize_t; pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; - pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, - flags: ::c_int, timeout: *mut ::timespec) -> ::c_int; pub fn uname(buf: *mut ::utsname) -> ::c_int; } From c6f899c3c1de405fb673efdba7a68d7a8d325cf5 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 11:10:28 +0000 Subject: [PATCH 09/16] Remove duplicate definition --- src/unix/notbsd/android/mod.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index c7eefceec6ace..3fc03ade7318c 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -51,11 +51,6 @@ s! { pub cmsg_type: ::c_int, } - pub struct mmsghdr { - pub msg_hdr: ::msghdr, - pub msg_len: ::c_uint, - } - pub struct termios { pub c_iflag: ::tcflag_t, pub c_oflag: ::tcflag_t, From ad1bd7eb855b5242984ea274e4ca1e173e9af16d Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 11:21:51 +0000 Subject: [PATCH 10/16] Match the freebsd types --- src/unix/bsd/freebsdlike/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 980bf3d1c1ff2..f5d276f2bc78f 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1245,10 +1245,10 @@ extern { pub fn uselocale(loc: ::locale_t) -> ::locale_t; pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, times: *const ::timespec, flag: ::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; + 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: *mut ::timespec) -> ::ssize_t; } #[link(name = "util")] From b8b510b73483d8f69de03d94f920c6e7017f6805 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 14:07:31 +0000 Subject: [PATCH 11/16] freebsd timespec is const --- src/unix/bsd/freebsdlike/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index f5d276f2bc78f..384fd416004ba 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1248,7 +1248,7 @@ extern { 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: *mut ::timespec) -> ::ssize_t; + flags: ::c_int, timeout: *const ::timespec) -> ::ssize_t; } #[link(name = "util")] From 80f1b51ac0af3c8b7e4493fddceaf60deae89f0e Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 14:08:45 +0000 Subject: [PATCH 12/16] openbsd lacks sendmmsg()/recvmmsg() --- src/unix/bsd/netbsdlike/mod.rs | 4 ---- src/unix/bsd/netbsdlike/netbsd/mod.rs | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index 22b2570c21367..e9d6506c59a53 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -719,10 +719,6 @@ 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 uname(buf: *mut ::utsname) -> ::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; } cfg_if! { diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 36a5366e6824c..e41a501d0e1c1 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1238,6 +1238,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")] From d676d6e97a5b05ff9d6583a468b67b22716d4c3a Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 17:33:31 +0000 Subject: [PATCH 13/16] dragonflybsd lacks sendmmsg()/recvmsg() --- src/unix/bsd/freebsdlike/freebsd/mod.rs | 10 ++++++++++ src/unix/bsd/freebsdlike/mod.rs | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 0d0eb3f3b0ff5..da144183ca368 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -135,6 +135,11 @@ s! { pub ss_size: ::size_t, pub ss_flags: ::c_int, } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::ssize_t, + } } s_no_extra_traits! { @@ -1205,6 +1210,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")] diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 384fd416004ba..ca9ed982be5fa 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -186,11 +186,6 @@ s! { pub ar_pln: u8, pub ar_op: u16, } - - pub struct mmsghdr { - pub msg_hdr: ::msghdr, - pub msg_len: ::ssize_t, - } } s_no_extra_traits! { @@ -1245,10 +1240,6 @@ extern { pub fn uselocale(loc: ::locale_t) -> ::locale_t; pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, times: *const ::timespec, flag: ::c_int) -> ::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")] From 250aa2496a8dee6181ce702073359480e89c1bd7 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 17:34:29 +0000 Subject: [PATCH 14/16] openbsd doesn't have mmsghdr either! --- src/unix/bsd/netbsdlike/mod.rs | 5 ----- src/unix/bsd/netbsdlike/netbsd/mod.rs | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index e9d6506c59a53..d03529662faa4 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -61,11 +61,6 @@ s! { pub l_type: ::c_short, pub l_whence: ::c_short, } - - pub struct mmsghdr { - pub msg_hdr: ::msghdr, - pub msg_len: ::c_uint, - } } pub const D_T_FMT: ::nl_item = 0; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index e41a501d0e1c1..28c0a6dcc79ee 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -268,6 +268,11 @@ s! { pub sdl_slen: ::uint8_t, pub sdl_data: [::c_char; 12], } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_uint, + } } s_no_extra_traits! { From d6310d63b39a8d6c49a4f60e69862d1a381f8453 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 21:52:47 +0000 Subject: [PATCH 15/16] Qualify type name --- src/unix/notbsd/emscripten/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/notbsd/emscripten/mod.rs b/src/unix/notbsd/emscripten/mod.rs index 5de7b5ac57608..624c900afa271 100644 --- a/src/unix/notbsd/emscripten/mod.rs +++ b/src/unix/notbsd/emscripten/mod.rs @@ -1648,9 +1648,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; From d3c0eec14965c8d9290fa2c0dc69737701b584e0 Mon Sep 17 00:00:00 2001 From: David Holroyd Date: Sun, 27 Jan 2019 22:35:32 +0000 Subject: [PATCH 16/16] Remove struct which is now a duplicate --- src/unix/notbsd/emscripten/mod.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/unix/notbsd/emscripten/mod.rs b/src/unix/notbsd/emscripten/mod.rs index 624c900afa271..c084579da67e0 100644 --- a/src/unix/notbsd/emscripten/mod.rs +++ b/src/unix/notbsd/emscripten/mod.rs @@ -169,11 +169,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,