Skip to content
Open
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
12 changes: 10 additions & 2 deletions src/backend/libc/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
//! for converting between rustix's types and libc types.

use super::c;
#[cfg(all(feature = "alloc", not(any(windows, target_os = "espidf"))))]
#[cfg(all(
feature = "alloc",
not(any(windows, target_os = "espidf", target_os = "horizon"))
))]
use super::fd::IntoRawFd as _;
use super::fd::{AsRawFd as _, BorrowedFd, FromRawFd as _, LibcFd, OwnedFd, RawFd};
#[cfg(not(windows))]
Expand Down Expand Up @@ -35,7 +38,12 @@ pub(super) fn borrowed_fd(fd: BorrowedFd<'_>) -> LibcFd {

#[cfg(all(
feature = "alloc",
not(any(windows, target_os = "espidf", target_os = "redox"))
not(any(
windows,
target_os = "espidf",
target_os = "horizon",
target_os = "redox"
))
))]
#[inline]
pub(super) fn owned_fd(fd: OwnedFd) -> LibcFd {
Expand Down
7 changes: 6 additions & 1 deletion src/backend/libc/event/poll_fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ use bitflags::bitflags;
use core::fmt;
use core::marker::PhantomData;

#[cfg(not(target_os = "horizon"))]
pub(crate) type RawPollFlags = ffi::c_short;
#[cfg(target_os = "horizon")]
pub(crate) type RawPollFlags = ffi::c_int;

bitflags! {
/// `POLL*` flags for use with [`poll`].
///
/// [`poll`]: crate::event::poll
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct PollFlags: ffi::c_short {
pub struct PollFlags: RawPollFlags {
/// `POLLIN`
const IN = c::POLLIN;
/// `POLLPRI`
Expand Down
5 changes: 4 additions & 1 deletion src/backend/libc/fs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
#[cfg(all(
feature = "alloc",
not(any(target_os = "espidf", target_os = "horizon", target_os = "redox"))
))]
pub(crate) mod dir;
#[cfg(linux_kernel)]
pub mod inotify;
Expand Down
3 changes: 2 additions & 1 deletion src/backend/libc/fs/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ use crate::fs::SealFlags;
target_os = "wasi",
)))]
use crate::fs::StatFs;
#[cfg(not(any(target_os = "espidf", target_os = "vita")))]
#[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))]
use crate::fs::Timestamps;
#[cfg(not(any(
apple,
target_os = "espidf",
target_os = "horizon",
target_os = "redox",
target_os = "vita",
target_os = "wasi"
Expand Down
2 changes: 2 additions & 0 deletions src/backend/libc/fs/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::backend::c;
#[cfg(not(target_os = "horizon"))]
use crate::ffi;
use bitflags::bitflags;

Expand Down Expand Up @@ -627,6 +628,7 @@ impl FileType {
target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "horizon",
target_os = "nto",
target_os = "redox",
target_os = "vita"
Expand Down
1 change: 1 addition & 0 deletions src/backend/libc/io/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::fd::{AsFd as _, BorrowedFd, OwnedFd, RawFd};
#[cfg(not(any(
target_os = "aix",
target_os = "espidf",
target_os = "horizon",
target_os = "nto",
target_os = "vita",
target_os = "wasi"
Expand Down
1 change: 1 addition & 0 deletions src/backend/libc/net/sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use crate::net::xdp::{XdpMmapOffsets, XdpOptionsFlags, XdpRingOffset, XdpStatist
target_os = "emscripten",
target_os = "espidf",
target_os = "haiku",
target_os = "horizon",
target_os = "netbsd",
target_os = "nto",
target_os = "vita",
Expand Down
1 change: 1 addition & 0 deletions src/backend/libc/pipe/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::io;
target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "horizon",
target_os = "nto",
target_os = "wasi"
)))]
Expand Down
2 changes: 2 additions & 0 deletions src/backend/libc/process/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::backend::conv::ret_discarded_char_ptr;
#[cfg(not(any(
target_os = "espidf",
target_os = "fuchsia",
target_os = "horizon",
target_os = "redox",
target_os = "vita",
target_os = "wasi"
Expand Down Expand Up @@ -48,6 +49,7 @@ use crate::process::Signal;
#[cfg(not(any(
target_os = "espidf",
target_os = "fuchsia",
target_os = "horizon",
target_os = "vita",
target_os = "wasi"
)))]
Expand Down
1 change: 1 addition & 0 deletions src/backend/libc/process/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[cfg(not(any(
target_os = "espidf",
target_os = "fuchsia",
target_os = "horizon",
target_os = "redox",
target_os = "vita",
target_os = "wasi"
Expand Down
1 change: 1 addition & 0 deletions src/backend/libc/system/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use {
#[cfg(not(any(
target_os = "emscripten",
target_os = "espidf",
target_os = "horizon",
target_os = "redox",
target_os = "vita",
target_os = "wasi"
Expand Down
1 change: 1 addition & 0 deletions src/backend/libc/thread/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::pid::Pid;
target_os = "emscripten",
target_os = "espidf",
target_os = "haiku",
target_os = "horizon",
target_os = "openbsd",
target_os = "redox",
target_os = "vita",
Expand Down
10 changes: 8 additions & 2 deletions src/fs/at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ use crate::fs::CloneFlags;
use crate::fs::RenameFlags;
#[cfg(not(target_os = "espidf"))]
use crate::fs::Stat;
#[cfg(not(any(apple, target_os = "espidf", target_os = "vita", target_os = "wasi")))]
#[cfg(not(any(
apple,
target_os = "espidf",
target_os = "horizon",
target_os = "vita",
target_os = "wasi"
)))]
use crate::fs::{Dev, FileType};
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
use crate::fs::{Gid, Uid};
Expand All @@ -34,7 +40,7 @@ use {
alloc::vec::Vec,
backend::fd::BorrowedFd,
};
#[cfg(not(any(target_os = "espidf", target_os = "vita")))]
#[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))]
use {crate::fs::Timestamps, crate::timespec::Nsecs};

/// `UTIME_NOW` for use with [`utimensat`].
Expand Down
10 changes: 8 additions & 2 deletions src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ mod at;
mod constants;
#[cfg(linux_kernel)]
mod copy_file_range;
#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
#[cfg(all(
feature = "alloc",
not(any(target_os = "espidf", target_os = "horizon", target_os = "redox"))
))]
mod dir;
#[cfg(not(any(
apple,
Expand Down Expand Up @@ -70,7 +73,10 @@ pub use at::*;
pub use constants::*;
#[cfg(linux_kernel)]
pub use copy_file_range::copy_file_range;
#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
#[cfg(all(
feature = "alloc",
not(any(target_os = "espidf", target_os = "horizon", target_os = "redox"))
))]
pub use dir::{Dir, DirEntry};
#[cfg(not(any(
apple,
Expand Down
1 change: 1 addition & 0 deletions src/net/sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ use crate::net::xdp::{XdpMmapOffsets, XdpOptionsFlags, XdpStatistics, XdpUmemReg
target_os = "emscripten",
target_os = "espidf",
target_os = "haiku",
target_os = "horizon",
target_os = "netbsd",
target_os = "nto",
target_os = "vita",
Expand Down
1 change: 1 addition & 0 deletions src/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::{backend, io};
windows,
target_os = "espidf",
target_os = "haiku",
target_os = "horizon",
target_os = "redox",
target_os = "vita",
target_os = "wasi",
Expand Down
24 changes: 3 additions & 21 deletions src/process/ioctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,17 @@ use backend::fd::AsFd;
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=tty&sektion=4
/// [NetBSD]: https://man.netbsd.org/tty.4
/// [OpenBSD]: https://man.openbsd.org/tty.4
#[cfg(not(any(
windows,
target_os = "aix",
target_os = "horizon",
target_os = "redox",
target_os = "wasi"
)))]
#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))]
#[inline]
#[doc(alias = "TIOCSCTTY")]
pub fn ioctl_tiocsctty<Fd: AsFd>(fd: Fd) -> io::Result<()> {
unsafe { ioctl::ioctl(fd, Tiocsctty) }
}

#[cfg(not(any(
windows,
target_os = "aix",
target_os = "horizon",
target_os = "redox",
target_os = "wasi"
)))]
#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))]
struct Tiocsctty;

#[cfg(not(any(
windows,
target_os = "aix",
target_os = "horizon",
target_os = "redox",
target_os = "wasi"
)))]
#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))]
unsafe impl ioctl::Ioctl for Tiocsctty {
type Output = ();

Expand Down
15 changes: 13 additions & 2 deletions src/process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ mod exit;
mod fcntl_getlk;
#[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id.
mod id;
#[cfg(not(any(target_os = "aix", target_os = "espidf", target_os = "vita")))]
#[cfg(not(any(
target_os = "aix",
target_os = "horizon",
target_os = "espidf",
target_os = "vita"
)))]
mod ioctl;
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
mod kill;
Expand Down Expand Up @@ -74,7 +79,12 @@ pub use exit::*;
pub use fcntl_getlk::*;
#[cfg(not(target_os = "wasi"))]
pub use id::*;
#[cfg(not(any(target_os = "aix", target_os = "espidf", target_os = "vita")))]
#[cfg(not(any(
target_os = "aix",
target_os = "espidf",
target_os = "horizon",
target_os = "vita"
)))]
pub use ioctl::*;
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
pub use kill::*;
Expand Down Expand Up @@ -103,6 +113,7 @@ pub use rlimit::*;
target_os = "emscripten",
target_os = "espidf",
target_os = "fuchsia",
target_os = "horizon",
target_os = "redox",
target_os = "vita",
target_os = "wasi"
Expand Down
3 changes: 3 additions & 0 deletions src/process/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

#![allow(unsafe_code)]

#[cfg(not(target_os = "horizon"))]
use crate::backend::c;
#[cfg(not(target_os = "horizon"))]
use crate::pid::Pid;
#[cfg(not(target_os = "horizon"))]
use core::mem::transmute;

/// File lock data structure used in [`fcntl_getlk`].
Expand Down
7 changes: 6 additions & 1 deletion src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ use crate::backend;
#[cfg(target_os = "linux")]
use crate::backend::c;
use crate::ffi::CStr;
#[cfg(not(any(target_os = "espidf", target_os = "emscripten", target_os = "vita")))]
#[cfg(not(any(
target_os = "espidf",
target_os = "emscripten",
target_os = "horizon",
target_os = "vita"
)))]
use crate::io;
use core::fmt;

Expand Down
Loading