Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GNU/Hurd support #852

Merged
merged 1 commit into from Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/backend/libc/fs/dir.rs
Expand Up @@ -20,9 +20,9 @@ use crate::io;
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
use crate::process::fchdir;
use alloc::borrow::ToOwned;
#[cfg(not(linux_like))]
#[cfg(not(any(linux_like, target_os = "hurd")))]
use c::readdir as libc_readdir;
#[cfg(linux_like)]
#[cfg(any(linux_like, target_os = "hurd"))]
use c::readdir64 as libc_readdir;
use core::fmt;
use core::ptr::NonNull;
Expand Down
4 changes: 2 additions & 2 deletions src/backend/libc/fs/syscalls.rs
Expand Up @@ -122,7 +122,7 @@ weak!(fn __futimens64(c::c_int, *const LibcTimespec) -> c::c_int);
/// Use a direct syscall (via libc) for `openat`.
///
/// This is only currently necessary as a workaround for old glibc; see below.
#[cfg(all(unix, target_env = "gnu"))]
#[cfg(all(unix, target_env = "gnu", not(target_os = "hurd")))]
fn openat_via_syscall(
dirfd: BorrowedFd<'_>,
path: &CStr,
Expand Down Expand Up @@ -153,7 +153,7 @@ pub(crate) fn openat(
) -> io::Result<OwnedFd> {
// Work around <https://sourceware.org/bugzilla/show_bug.cgi?id=17523>.
// glibc versions before 2.25 don't handle `O_TMPFILE` correctly.
#[cfg(all(unix, target_env = "gnu"))]
#[cfg(all(unix, target_env = "gnu", not(target_os = "hurd")))]
if oflags.contains(OFlags::TMPFILE) && crate::backend::if_glibc_is_less_than_2_25() {
return openat_via_syscall(dirfd, path, oflags, mode);
}
Expand Down
11 changes: 10 additions & 1 deletion src/backend/libc/fs/types.rs
Expand Up @@ -274,6 +274,7 @@ bitflags! {
target_os = "android",
target_os = "emscripten",
target_os = "fuchsia",
target_os = "hurd",
target_os = "linux",
))]
const TMPFILE = c::O_TMPFILE;
Expand Down Expand Up @@ -717,6 +718,7 @@ bitflags! {
bsd,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "wasi",
)))]
const KEEP_SIZE = c::FALLOC_FL_KEEP_SIZE;
Expand All @@ -725,6 +727,7 @@ bitflags! {
bsd,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "wasi",
)))]
const PUNCH_HOLE = c::FALLOC_FL_PUNCH_HOLE;
Expand All @@ -733,6 +736,7 @@ bitflags! {
bsd,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "linux",
target_os = "emscripten",
target_os = "fuchsia",
Expand All @@ -744,6 +748,7 @@ bitflags! {
bsd,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
target_os = "wasi",
)))]
Expand All @@ -753,6 +758,7 @@ bitflags! {
bsd,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
target_os = "wasi",
)))]
Expand All @@ -762,6 +768,7 @@ bitflags! {
bsd,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
target_os = "wasi",
)))]
Expand All @@ -771,6 +778,7 @@ bitflags! {
bsd,
target_os = "aix",
target_os = "haiku",
target_os = "hurd",
target_os = "emscripten",
target_os = "wasi",
)))]
Expand Down Expand Up @@ -844,7 +852,7 @@ pub enum FlockOperation {
///
/// [`statat`]: crate::fs::statat
/// [`fstat`]: crate::fs::fstat
#[cfg(not(linux_like))]
#[cfg(not(any(linux_like, target_os = "hurd")))]
pub type Stat = c::stat;

/// `struct stat` for use with [`statat`] and [`fstat`].
Expand All @@ -853,6 +861,7 @@ pub type Stat = c::stat;
/// [`fstat`]: crate::fs::fstat
#[cfg(any(
all(linux_kernel, target_pointer_width = "64"),
target_os = "hurd",
target_os = "emscripten",
target_os = "l4re",
))]
Expand Down