From d94489d13b866ddb4d60392042c27e38b9aa0e45 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 22c11b3698a32..fc308b9f6ebdd 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -181,6 +181,11 @@ s! { pub ar_pln: u8, pub ar_op: u16, } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_ssize_t, + } } pub const AIO_LISTIO_MAX: ::c_int = 16; diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 12f6e14d93c7c..c65d680f65747 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -502,6 +502,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 291c081b97bc7..67758170beab0 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -59,6 +59,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 972281c8287b6..f3aa7dc826514 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -75,6 +75,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 8669a06ca5954..0022e288f9a60 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -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, @@ -2008,10 +2003,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 668c25f7fee22..23c4bcff6dfee 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -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 @@ -1242,6 +1247,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 b354b10a84e122a306fe6276d34866d0b531ce99 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 c65d680f65747..000615c724285 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -502,8 +502,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 163a928d8cc475d06d99b41687707bc44e27fcc6 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 000615c724285..4c802b4f4bf85 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -503,10 +503,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 23c4bcff6dfee..41adfa3712a83 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -1247,9 +1247,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 ddb7b315cc4c96ee84aa68954f650c25f9f262e7 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 f3aa7dc826514..cbe79576932c0 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -1727,6 +1727,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 0022e288f9a60..609fe8d2345c9 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -2003,6 +2003,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 41adfa3712a83..4b51e18239d86 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -1247,8 +1247,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 abfb526e7adf4314019d4fe3970480cf59383dad 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 fc308b9f6ebdd..09b7a3401aa27 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -184,7 +184,7 @@ s! { pub struct mmsghdr { pub msg_hdr: ::msghdr, - pub msg_len: ::c_ssize_t, + pub msg_len: ::ssize_t, } } From e78e3aaeb56f8b3af15f480639651fee77d450a7 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 4c802b4f4bf85..bacb4472fbcf2 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -502,10 +502,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 e65cd73cdc247267ff7904aebe187cf1269d41bf 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 09b7a3401aa27..07119a7a7c119 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1229,6 +1229,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 bacb4472fbcf2..12f6e14d93c7c 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -502,13 +502,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 67758170beab0..e33dae23bfd9c 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -717,6 +717,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 2f8cbb47f5a31a1c9424913ca6a740f0ff21e9ec 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 cbe79576932c0..d83a1d52b9866 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -1729,6 +1729,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 609fe8d2345c9..91fd711e17a98 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -2005,6 +2005,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 4b51e18239d86..a768206250acb 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -1247,8 +1247,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 e313f700a7fb71bc2a216d9c0fb4515ffff85dab 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 d83a1d52b9866..d4fa7b1c0536e 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -75,11 +75,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 2a76b2589c8ab7bd720ba9c33d44a975edcaa752 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 07119a7a7c119..f06228c6f90bd 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1229,10 +1229,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 8432dafeddd475df269e2cbf655d5793a89329db 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 f06228c6f90bd..b9c02d5ac8d75 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1232,7 +1232,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 6f6297301d49ff67b8ca044d651f36a56950298c 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 e33dae23bfd9c..67758170beab0 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -717,10 +717,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 d3acfb9394ae8..c08a46d8c0cd7 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1199,6 +1199,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 b8c39802f75ce2c7ebb78748870e18c22890cf28 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 91eab30b9e045..13ffc95b0b4c0 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -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; @@ -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")] diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index b9c02d5ac8d75..22c11b3698a32 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -181,11 +181,6 @@ s! { pub ar_pln: u8, pub ar_op: u16, } - - pub struct mmsghdr { - pub msg_hdr: ::msghdr, - pub msg_len: ::ssize_t, - } } pub const AIO_LISTIO_MAX: ::c_int = 16; @@ -1229,10 +1224,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 f077cef7bc69dc43f093e4817283e35365096032 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 67758170beab0..291c081b97bc7 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -59,11 +59,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 c08a46d8c0cd7..9ab4f65a5eb0a 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -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; From 696d27349abd7e91db1dde9973bb4f3ea83b2b3c 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.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/notbsd/emscripten.rs b/src/unix/notbsd/emscripten.rs index 28791d8fd5ac7..2fefacf63c26d 100644 --- a/src/unix/notbsd/emscripten.rs +++ b/src/unix/notbsd/emscripten.rs @@ -1666,9 +1666,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 0d3a60046bbb1133ad9cf6287ee945d89562f058 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.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/unix/notbsd/emscripten.rs b/src/unix/notbsd/emscripten.rs index 2fefacf63c26d..58440e5961c40 100644 --- a/src/unix/notbsd/emscripten.rs +++ b/src/unix/notbsd/emscripten.rs @@ -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,