Skip to content

Commit

Permalink
OpenBSD: add sendmmsg and recvmmsg support.
Browse files Browse the repository at this point in the history
(backport <rust-lang#3831>)
(cherry picked from commit c369185)
  • Loading branch information
devnexen authored and tgross35 committed Aug 29, 2024
1 parent 4c0eaac commit 9b88c55
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
3 changes: 3 additions & 0 deletions libc-test/semver/openbsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,7 @@ mknodat
mkostemp
mkostemps
mkstemps
mmsghdr
mount_info
mrand48
msdosfs_args
Expand Down Expand Up @@ -1216,6 +1217,7 @@ readlinkat
reallocarray
reboot
recvmsg
recvmmsg
regcomp
regerror
regex_t
Expand All @@ -1237,6 +1239,7 @@ sem_init
sem_open
sem_timedwait
sem_unlink
sendmmsg
sendmsg
setdomainname
setgrent
Expand Down
19 changes: 19 additions & 0 deletions src/unix/bsd/netbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -848,6 +853,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! {
Expand Down
19 changes: 0 additions & 19 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -2781,20 +2776,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,
Expand Down

0 comments on commit 9b88c55

Please sign in to comment.