Skip to content

Commit

Permalink
more gates
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed Dec 30, 2024
1 parent cfe6ffd commit 823f0db
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions dgram/src/socket_setup.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::io;
use std::os::fd::AsFd;

#[cfg(target_os = "linux")]
use super::linux_imports::*;
#[cfg(unix)]
use std::os::fd::AsFd;

/// Indicators of settings applied to a socket. These settings aren't "applied"
/// to a socket. Rather, the same (maximal) settings are always applied to a
Expand Down Expand Up @@ -52,7 +53,7 @@ pub fn set_gso_segment(sock: &impl AsFd, segment: usize) -> io::Result<()> {
Ok(())
}

#[cfg(not(target_os = "linux"))]
#[cfg(all(not(target_os = "linux"), unix))]
pub fn set_gso_segment(_: &impl AsFd, _: usize) -> io::Result<()> {
Err(std::io::Error::from(std::io::ErrorKind::Unsupported))
}
Expand All @@ -65,6 +66,7 @@ pub fn set_gro(sock: &impl AsFd) -> io::Result<()> {
}

#[cfg(not(target_os = "linux"))]
#[cfg(all(not(target_os = "linux"), unix))]
pub fn set_gro(_: &impl AsFd) -> io::Result<()> {
Err(std::io::Error::from(std::io::ErrorKind::Unsupported))
}
Expand All @@ -76,7 +78,7 @@ fn set_udp_rxq_ovfl(sock: &impl AsFd) -> io::Result<()> {
Ok(())
}

#[cfg(not(target_os = "linux"))]
#[cfg(all(not(target_os = "linux"), unix))]
fn set_udp_rxq_ovfl(_: &impl AsFd) -> io::Result<()> {
Err(std::io::Error::from(std::io::ErrorKind::Unsupported))
}
Expand All @@ -93,7 +95,7 @@ pub fn set_tx_time(sock: &impl AsFd) -> io::Result<()> {
Ok(())
}

#[cfg(not(target_os = "linux"))]
#[cfg(all(not(target_os = "linux"), unix))]
pub fn set_tx_time(_: &impl AsFd) -> io::Result<()> {
Err(std::io::Error::from(std::io::ErrorKind::Unsupported))
}
Expand All @@ -105,7 +107,7 @@ pub fn set_rx_time(sock: &impl AsFd) -> io::Result<()> {
Ok(())
}

#[cfg(not(target_os = "linux"))]
#[cfg(all(not(target_os = "linux"), unix))]
pub fn set_rx_time(_: &impl AsFd) -> io::Result<()> {
Err(std::io::Error::from(std::io::ErrorKind::Unsupported))
}

0 comments on commit 823f0db

Please sign in to comment.