about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorUrgau <3616612+Urgau@users.noreply.github.com>2025-02-09 00:37:27 +0100
committerGitHub <noreply@github.com>2025-02-09 00:37:27 +0100
commit9530d243d740eb7f8eddc0a08dad635a8ff4189a (patch)
tree8955541759dfb79cdc83c57160491b2f208ad9ed /library/std/src/sys
parent34182470ebbc0c8fd67f09c7902b3bd44f4abbe5 (diff)
parent719127c6d500e726628224c64ff3e4323e870d29 (diff)
downloadrust-9530d243d740eb7f8eddc0a08dad635a8ff4189a.tar.gz
rust-9530d243d740eb7f8eddc0a08dad635a8ff4189a.zip
Rollup merge of #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 #120426

try-job: dist-various-2
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/pal/unix/fs.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/library/std/src/sys/pal/unix/fs.rs b/library/std/src/sys/pal/unix/fs.rs
index 6c41781fe85..00cfa7a7fcf 100644
--- a/library/std/src/sys/pal/unix/fs.rs
+++ b/library/std/src/sys/pal/unix/fs.rs
@@ -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(
@@ -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",
@@ -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
@@ -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
@@ -1211,6 +1215,7 @@ impl File {
         }
         #[cfg(any(
             target_os = "freebsd",
+            target_os = "fuchsia",
             target_os = "linux",
             target_os = "android",
             target_os = "netbsd",
@@ -1223,6 +1228,7 @@ impl File {
         }
         #[cfg(not(any(
             target_os = "android",
+            target_os = "fuchsia",
             target_os = "freebsd",
             target_os = "linux",
             target_os = "netbsd",
@@ -1238,6 +1244,7 @@ impl File {
 
     #[cfg(any(
         target_os = "freebsd",
+        target_os = "fuchsia",
         target_os = "linux",
         target_os = "netbsd",
         target_vendor = "apple",
@@ -1249,6 +1256,7 @@ impl File {
 
     #[cfg(not(any(
         target_os = "freebsd",
+        target_os = "fuchsia",
         target_os = "linux",
         target_os = "netbsd",
         target_vendor = "apple",
@@ -1259,6 +1267,7 @@ impl File {
 
     #[cfg(any(
         target_os = "freebsd",
+        target_os = "fuchsia",
         target_os = "linux",
         target_os = "netbsd",
         target_vendor = "apple",
@@ -1270,6 +1279,7 @@ impl File {
 
     #[cfg(not(any(
         target_os = "freebsd",
+        target_os = "fuchsia",
         target_os = "linux",
         target_os = "netbsd",
         target_vendor = "apple",
@@ -1280,6 +1290,7 @@ impl File {
 
     #[cfg(any(
         target_os = "freebsd",
+        target_os = "fuchsia",
         target_os = "linux",
         target_os = "netbsd",
         target_vendor = "apple",
@@ -1297,6 +1308,7 @@ impl File {
 
     #[cfg(not(any(
         target_os = "freebsd",
+        target_os = "fuchsia",
         target_os = "linux",
         target_os = "netbsd",
         target_vendor = "apple",
@@ -1307,6 +1319,7 @@ impl File {
 
     #[cfg(any(
         target_os = "freebsd",
+        target_os = "fuchsia",
         target_os = "linux",
         target_os = "netbsd",
         target_vendor = "apple",
@@ -1324,6 +1337,7 @@ impl File {
 
     #[cfg(not(any(
         target_os = "freebsd",
+        target_os = "fuchsia",
         target_os = "linux",
         target_os = "netbsd",
         target_vendor = "apple",
@@ -1334,6 +1348,7 @@ impl File {
 
     #[cfg(any(
         target_os = "freebsd",
+        target_os = "fuchsia",
         target_os = "linux",
         target_os = "netbsd",
         target_vendor = "apple",
@@ -1345,6 +1360,7 @@ impl File {
 
     #[cfg(not(any(
         target_os = "freebsd",
+        target_os = "fuchsia",
         target_os = "linux",
         target_os = "netbsd",
         target_vendor = "apple",