Skip to content

Commit c709020

Browse files
committed
Add freebsd/netbsd back, having added libc support
This reverts commit ca4611d.
1 parent ca4611d commit c709020

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/sys/socket/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ use sys::time::TimeVal;
1111
use sys::uio::IoVec;
1212
#[cfg(any(
1313
target_os = "linux",
14+
target_os = "freebsd",
15+
target_os = "netbsd",
1416
))]
1517
use sys::time::TimeSpec;
1618
#[cfg(any(
1719
target_os = "linux",
20+
target_os = "freebsd",
21+
target_os = "netbsd",
1822
))]
1923
use std::marker::PhantomData;
2024

@@ -1345,13 +1349,17 @@ pub fn shutdown(df: RawFd, how: Shutdown) -> Result<()> {
13451349

13461350
#[cfg(any(
13471351
target_os = "linux",
1352+
target_os = "freebsd",
1353+
target_os = "netbsd",
13481354
))]
13491355
#[repr(C)]
13501356
#[allow(missing_debug_implementations)]
13511357
pub struct SendMMsgHdr<'a>(libc::mmsghdr, PhantomData<&'a ()>);
13521358

13531359
#[cfg(any(
13541360
target_os = "linux",
1361+
target_os = "freebsd",
1362+
target_os = "netbsd",
13551363
))]
13561364
impl<'a> SendMMsgHdr<'a> {
13571365
pub fn new(iov: &mut[IoVec<&'a mut [u8]>],
@@ -1436,13 +1444,17 @@ impl<'a> SendMMsgHdr<'a> {
14361444

14371445
#[cfg(any(
14381446
target_os = "linux",
1447+
target_os = "freebsd",
1448+
target_os = "netbsd",
14391449
))]
14401450
#[repr(C)]
14411451
#[allow(missing_debug_implementations)]
14421452
pub struct RecvMMsgHdr<'a>(libc::mmsghdr, PhantomData<&'a ()>);
14431453

14441454
#[cfg(any(
14451455
target_os = "linux",
1456+
target_os = "freebsd",
1457+
target_os = "netbsd",
14461458
))]
14471459
impl<'a> RecvMMsgHdr<'a> {
14481460
pub fn new<T>(iov: &mut[IoVec<&'a mut [u8]>],
@@ -1505,6 +1517,8 @@ impl<'a> RecvMMsgHdr<'a> {
15051517
/// Receive multiple messages from a socket using a single system call.
15061518
#[cfg(any(
15071519
target_os = "linux",
1520+
target_os = "freebsd",
1521+
target_os = "netbsd",
15081522
))]
15091523
pub fn recvmmsg(fd: RawFd, msgvec: &mut[RecvMMsgHdr],
15101524
flags: MsgFlags,
@@ -1528,6 +1542,8 @@ pub fn recvmmsg(fd: RawFd, msgvec: &mut[RecvMMsgHdr],
15281542
/// Transmit multiple messages on a socket using a single system call.
15291543
#[cfg(any(
15301544
target_os = "linux",
1545+
target_os = "freebsd",
1546+
target_os = "netbsd",
15311547
))]
15321548
pub fn sendmmsg(fd: RawFd, msgvec: &mut[SendMMsgHdr]) -> Result<usize> {
15331549
let ret = unsafe {

test/sys/test_socket.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,8 @@ pub fn test_recv_ipv6pktinfo() {
962962

963963
#[cfg(any(
964964
target_os = "linux",
965+
target_os = "freebsd",
966+
target_os = "netbsd",
965967
))]
966968
#[test]
967969
pub fn test_mmsg() {

0 commit comments

Comments
 (0)