Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
- aarch64-apple-tvos
- aarch64-apple-visionos
- aarch64-apple-watchos
- x86_64-unknown-openbsd
steps:
- uses: actions/checkout@v6
- uses: Swatinem/rust-cache@v2
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default = []
nightly = []

[dependencies]
libc = { version = "0.2.179", default-features = false }
libc = { version = "0.2.181", default-features = false }
log = { version = "0.4.21", default-features = false, features = ["kv_std"] }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/kqueue/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ impl_fd_op!(TruncateOp);
pub(crate) use libc::stat as Stat;

pub(crate) const fn file_type(stat: &Stat) -> FileType {
FileType(stat.st_mode)
FileType(stat.st_mode as u16)
}

pub(crate) const fn len(stat: &Stat) -> u64 {
Expand All @@ -288,7 +288,7 @@ pub(crate) const fn block_size(stat: &Stat) -> u32 {
}

pub(crate) const fn permissions(stat: &Stat) -> Permissions {
Permissions(stat.st_mode)
Permissions(stat.st_mode as u16)
}

pub(crate) fn modified(stat: &Stat) -> SystemTime {
Expand Down
8 changes: 6 additions & 2 deletions src/kqueue/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ impl crate::op::Op for WaitIdOp {
let options = options.0.cast_signed() | libc::WNOHANG; // Don't block.
syscall!(waitid(id_type, pid.into(), &raw mut info.0, options))?;

if info.0.si_pid == 0 {
#[cfg(not(target_os = "openbsd"))]
let pid = info.0.si_pid;
#[cfg(any(target_os = "openbsd"))]
let pid = unsafe { info.0.si_pid() };
if pid == 0 {
// Got polled without the process stopping, will have to
// wait again.
Poll::Pending
Expand Down Expand Up @@ -134,7 +138,7 @@ fn sigaction(signals: &SignalSet, action: libc::sighandler_t) -> io::Result<()>
target_os = "watchos",
))]
let sa_mask = 0;
#[cfg(target_os = "freebsd")]
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
let sa_mask = SignalSet::empty()?.0;

let action = libc::sigaction {
Expand Down
15 changes: 13 additions & 2 deletions src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ new_flag!(
#[cfg(any(target_os = "android", target_os = "linux"))]
PACKET = libc::AF_PACKET,
/// Domain for low-level VSOCK interface.
#[cfg(not(target_os = "freebsd"))]
#[cfg(not(any(target_os = "freebsd", target_os = "openbsd")))]
VSOCK = libc::AF_VSOCK,
}

Expand Down Expand Up @@ -95,6 +95,7 @@ new_flag!(
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
DCCP = libc::IPPROTO_DCCP,
/// Stream Control Transport Protocol.
#[cfg(not(target_os = "openbsd"))]
SCTP = libc::IPPROTO_SCTP,
/// UDP-Lite.
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
Expand Down Expand Up @@ -628,17 +629,20 @@ new_flag!(
ADD_MEMBERSHIP = libc::IP_ADD_MEMBERSHIP,
/// Join a multicast group and allow receiving data only from a
/// specified source.
#[cfg(not(target_os = "openbsd"))]
ADD_SOURCE_MEMBERSHIP = libc::IP_ADD_SOURCE_MEMBERSHIP,
/// Do not reserve an ephemeral port when using `bind(2)` with a port
/// number of 0.
#[cfg(any(target_os = "android", target_os = "linux"))]
BIND_ADDRESS_NO_PORT = libc::IP_BIND_ADDRESS_NO_PORT,
/// Stop receiving multicast data from a specific source in a given
/// group.
#[cfg(not(target_os = "openbsd"))]
BLOCK_SOURCE = libc::IP_BLOCK_SOURCE,
/// Leave a multicast group.
DROP_MEMBERSHIP = libc::IP_DROP_MEMBERSHIP,
/// Leave a source-specific group.
#[cfg(not(target_os = "openbsd"))]
DROP_SOURCE_MEMBERSHIP = libc::IP_DROP_SOURCE_MEMBERSHIP,
/// Allow binding to an IP address that is nonlocal or does not (yet)
/// exist.
Expand Down Expand Up @@ -679,7 +683,7 @@ new_flag!(
#[cfg(any(target_os = "android", target_os = "linux"))]
PASS_SEC = libc::IP_PASSSEC,
/// Collect information about this socket.
#[cfg(not(target_os = "freebsd"))]
#[cfg(not(any(target_os = "freebsd", target_os = "openbsd")))]
PKT_INFO = libc::IP_PKTINFO,
/// Enable extended reliable error message passing.
#[cfg(any(target_os = "android", target_os = "linux"))]
Expand All @@ -693,9 +697,11 @@ new_flag!(
RECV_ORIG_DST_ADDR = libc::IP_RECVORIGDSTADDR,
/// Enable passing of `IP_TOS` in ancillary message with incoming
/// packets.
#[cfg(not(target_os = "openbsd"))]
RECV_TOS = libc::IP_RECVTOS,
/// Enable passing of `IP_TTL` in ancillary message with incoming
/// packets.
#[cfg(not(target_os = "openbsd"))]
RECV_TTL = libc::IP_RECVTTL,
/// Identical to [`IPv4Opt::RECV_OPTS`], but returns raw unprocessed
/// options with timestamp and route record options not filled in for
Expand All @@ -716,6 +722,7 @@ new_flag!(
/// this socket.
TTL = libc::IP_TTL,
/// Unblock previously blocked multicast source.
#[cfg(not(target_os = "openbsd"))]
UNBLOCK_SOURCE = libc::IP_UNBLOCK_SOURCE,
}

Expand Down Expand Up @@ -765,6 +772,7 @@ new_flag!(
#[cfg(any(target_os = "android", target_os = "linux"))]
FLOW_INFO = libc::IPV6_FLOWINFO,
/// Set hop limit.
#[cfg(not(target_os = "openbsd"))]
HOP_LIMIT = libc::IPV6_HOPLIMIT,
/// Control receiving of asynchronous error options.
#[cfg(any(target_os = "android", target_os = "linux"))]
Expand Down Expand Up @@ -799,12 +807,14 @@ new_flag!(
INFO = libc::TCP_INFO,
/// The maximum number of keepalive probes TCP should send before
/// dropping the connection.
#[cfg(not(target_os = "openbsd"))]
KEEP_CNT = libc::TCP_KEEPCNT,
/// The time (in seconds) the connection needs to remain idle before TCP
/// starts sending keepalive probes.
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
KEEP_IDLE = libc::TCP_KEEPIDLE,
/// The time (in seconds) between individual keepalive probes.
#[cfg(not(target_os = "openbsd"))]
KEEP_INTVL = libc::TCP_KEEPINTVL,
/// The lifetime of orphaned FIN_WAIT2 state sockets.
#[cfg(any(target_os = "android", target_os = "linux"))]
Expand All @@ -829,6 +839,7 @@ new_flag!(
#[cfg(any(target_os = "android", target_os = "linux"))]
WINDOW_CLAMP = libc::TCP_WINDOW_CLAMP,
/// This option enables Fast Open on the listener socket.
#[cfg(not(target_os = "openbsd"))]
FASTOPEN = libc::TCP_FASTOPEN,
/// This option enables an alternative way to perform Fast Open on the
/// client side.
Expand Down
Loading