Skip to content

Commit

Permalink
Unrolled build for rust-lang#136213
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#136213 - erickt:fs, r=Mark-Simulacrum

Allow Rust to use a number of libc filesystem calls

This allows Rust on Fuchsia to use a number of function calls from libc:

* dirfd
* fdatasync
* flock with LOCK_EX, LOCK_SH, LOCK_NB, LOCK_UN
* fstatat

cc rust-lang#120426

try-job: dist-various-2
  • Loading branch information
rust-timer authored Feb 9, 2025
2 parents 1ff2135 + 719127c commit e95ddc7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion library/std/src/sys/pal/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ use libc::c_char;
#[cfg(any(
all(target_os = "linux", not(target_env = "musl")),
target_os = "android",
target_os = "fuchsia",
target_os = "hurd"
))]
use libc::dirfd;
#[cfg(target_os = "fuchsia")]
use libc::fstatat as fstatat64;
#[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "hurd"))]
use libc::fstatat64;
#[cfg(any(
Expand Down Expand Up @@ -848,7 +851,6 @@ impl Drop for Dir {
target_os = "vita",
target_os = "hurd",
target_os = "espidf",
target_os = "fuchsia",
target_os = "horizon",
target_os = "vxworks",
target_os = "rtems",
Expand Down Expand Up @@ -880,6 +882,7 @@ impl DirEntry {
any(
all(target_os = "linux", not(target_env = "musl")),
target_os = "android",
target_os = "fuchsia",
target_os = "hurd"
),
not(miri) // no dirfd on Miri
Expand Down Expand Up @@ -908,6 +911,7 @@ impl DirEntry {
not(any(
all(target_os = "linux", not(target_env = "musl")),
target_os = "android",
target_os = "fuchsia",
target_os = "hurd",
)),
miri
Expand Down Expand Up @@ -1211,6 +1215,7 @@ impl File {
}
#[cfg(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "android",
target_os = "netbsd",
Expand All @@ -1223,6 +1228,7 @@ impl File {
}
#[cfg(not(any(
target_os = "android",
target_os = "fuchsia",
target_os = "freebsd",
target_os = "linux",
target_os = "netbsd",
Expand All @@ -1238,6 +1244,7 @@ impl File {

#[cfg(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_vendor = "apple",
Expand All @@ -1249,6 +1256,7 @@ impl File {

#[cfg(not(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_vendor = "apple",
Expand All @@ -1259,6 +1267,7 @@ impl File {

#[cfg(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_vendor = "apple",
Expand All @@ -1270,6 +1279,7 @@ impl File {

#[cfg(not(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_vendor = "apple",
Expand All @@ -1280,6 +1290,7 @@ impl File {

#[cfg(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_vendor = "apple",
Expand All @@ -1297,6 +1308,7 @@ impl File {

#[cfg(not(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_vendor = "apple",
Expand All @@ -1307,6 +1319,7 @@ impl File {

#[cfg(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_vendor = "apple",
Expand All @@ -1324,6 +1337,7 @@ impl File {

#[cfg(not(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_vendor = "apple",
Expand All @@ -1334,6 +1348,7 @@ impl File {

#[cfg(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_vendor = "apple",
Expand All @@ -1345,6 +1360,7 @@ impl File {

#[cfg(not(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_vendor = "apple",
Expand Down

0 comments on commit e95ddc7

Please sign in to comment.