From c36918572d2b91382753ec8b9516a5e8bebdeff2 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 15 Aug 2024 22:28:30 +0100 Subject: [PATCH] OpenBSD: add sendmmsg and recvmmsg support. close #3696 --- libc-test/semver/openbsd.txt | 3 +++ src/unix/bsd/netbsdlike/mod.rs | 19 +++++++++++++++++++ src/unix/bsd/netbsdlike/netbsd/mod.rs | 19 ------------------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index afb8afa7f50f0..3833884c855c5 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -1131,6 +1131,7 @@ mknodat mkostemp mkostemps mkstemps +mmsghdr mount_info mrand48 msdosfs_args @@ -1210,6 +1211,7 @@ readlinkat reallocarray reboot recvmsg +recvmmsg regcomp regerror regex_t @@ -1231,6 +1233,7 @@ sem_init sem_open sem_timedwait sem_unlink +sendmmsg sendmsg setdomainname setgrent diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index 35a8c0255be69..29f54b92cd48b 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -92,6 +92,11 @@ s! { pub piod_addr: *mut ::c_void, pub piod_len: ::size_t, } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_uint, + } } pub const D_T_FMT: ::nl_item = 0; @@ -847,6 +852,20 @@ extern "C" { pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; pub fn basename(path: *mut ::c_char) -> *mut ::c_char; pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; + + pub fn sendmmsg( + sockfd: ::c_int, + mmsg: *mut ::mmsghdr, + vlen: ::c_uint, + flags: ::c_int, + ) -> ::c_int; + pub fn recvmmsg( + sockfd: ::c_int, + mmsg: *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 7c58e85c4434c..f919b73e5c2f4 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -401,11 +401,6 @@ s! { pub sdl_data: [::c_char; 12], } - pub struct mmsghdr { - pub msg_hdr: ::msghdr, - pub msg_len: ::c_uint, - } - pub struct __exit_status { pub e_termination: u16, pub e_exit: u16, @@ -2759,20 +2754,6 @@ extern "C" { pub fn kqueue1(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; - pub fn _lwp_self() -> lwpid_t; pub fn memmem( haystack: *const ::c_void,