Skip to content

Commit 719127c

Browse files
committed
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
1 parent 0cffe5c commit 719127c

File tree

1 file changed

+17
-1
lines changed
  • library/std/src/sys/pal/unix

1 file changed

+17
-1
lines changed

Diff for: library/std/src/sys/pal/unix/fs.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ use libc::c_char;
99
#[cfg(any(
1010
all(target_os = "linux", not(target_env = "musl")),
1111
target_os = "android",
12+
target_os = "fuchsia",
1213
target_os = "hurd"
1314
))]
1415
use libc::dirfd;
16+
#[cfg(target_os = "fuchsia")]
17+
use libc::fstatat as fstatat64;
1518
#[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "hurd"))]
1619
use libc::fstatat64;
1720
#[cfg(any(
@@ -850,7 +853,6 @@ impl Drop for Dir {
850853
target_os = "vita",
851854
target_os = "hurd",
852855
target_os = "espidf",
853-
target_os = "fuchsia",
854856
target_os = "horizon",
855857
target_os = "vxworks",
856858
target_os = "rtems",
@@ -882,6 +884,7 @@ impl DirEntry {
882884
any(
883885
all(target_os = "linux", not(target_env = "musl")),
884886
target_os = "android",
887+
target_os = "fuchsia",
885888
target_os = "hurd"
886889
),
887890
not(miri) // no dirfd on Miri
@@ -910,6 +913,7 @@ impl DirEntry {
910913
not(any(
911914
all(target_os = "linux", not(target_env = "musl")),
912915
target_os = "android",
916+
target_os = "fuchsia",
913917
target_os = "hurd",
914918
)),
915919
miri
@@ -1213,6 +1217,7 @@ impl File {
12131217
}
12141218
#[cfg(any(
12151219
target_os = "freebsd",
1220+
target_os = "fuchsia",
12161221
target_os = "linux",
12171222
target_os = "android",
12181223
target_os = "netbsd",
@@ -1225,6 +1230,7 @@ impl File {
12251230
}
12261231
#[cfg(not(any(
12271232
target_os = "android",
1233+
target_os = "fuchsia",
12281234
target_os = "freebsd",
12291235
target_os = "linux",
12301236
target_os = "netbsd",
@@ -1240,6 +1246,7 @@ impl File {
12401246

12411247
#[cfg(any(
12421248
target_os = "freebsd",
1249+
target_os = "fuchsia",
12431250
target_os = "linux",
12441251
target_os = "netbsd",
12451252
target_vendor = "apple",
@@ -1251,6 +1258,7 @@ impl File {
12511258

12521259
#[cfg(not(any(
12531260
target_os = "freebsd",
1261+
target_os = "fuchsia",
12541262
target_os = "linux",
12551263
target_os = "netbsd",
12561264
target_vendor = "apple",
@@ -1261,6 +1269,7 @@ impl File {
12611269

12621270
#[cfg(any(
12631271
target_os = "freebsd",
1272+
target_os = "fuchsia",
12641273
target_os = "linux",
12651274
target_os = "netbsd",
12661275
target_vendor = "apple",
@@ -1272,6 +1281,7 @@ impl File {
12721281

12731282
#[cfg(not(any(
12741283
target_os = "freebsd",
1284+
target_os = "fuchsia",
12751285
target_os = "linux",
12761286
target_os = "netbsd",
12771287
target_vendor = "apple",
@@ -1282,6 +1292,7 @@ impl File {
12821292

12831293
#[cfg(any(
12841294
target_os = "freebsd",
1295+
target_os = "fuchsia",
12851296
target_os = "linux",
12861297
target_os = "netbsd",
12871298
target_vendor = "apple",
@@ -1299,6 +1310,7 @@ impl File {
12991310

13001311
#[cfg(not(any(
13011312
target_os = "freebsd",
1313+
target_os = "fuchsia",
13021314
target_os = "linux",
13031315
target_os = "netbsd",
13041316
target_vendor = "apple",
@@ -1309,6 +1321,7 @@ impl File {
13091321

13101322
#[cfg(any(
13111323
target_os = "freebsd",
1324+
target_os = "fuchsia",
13121325
target_os = "linux",
13131326
target_os = "netbsd",
13141327
target_vendor = "apple",
@@ -1326,6 +1339,7 @@ impl File {
13261339

13271340
#[cfg(not(any(
13281341
target_os = "freebsd",
1342+
target_os = "fuchsia",
13291343
target_os = "linux",
13301344
target_os = "netbsd",
13311345
target_vendor = "apple",
@@ -1336,6 +1350,7 @@ impl File {
13361350

13371351
#[cfg(any(
13381352
target_os = "freebsd",
1353+
target_os = "fuchsia",
13391354
target_os = "linux",
13401355
target_os = "netbsd",
13411356
target_vendor = "apple",
@@ -1347,6 +1362,7 @@ impl File {
13471362

13481363
#[cfg(not(any(
13491364
target_os = "freebsd",
1365+
target_os = "fuchsia",
13501366
target_os = "linux",
13511367
target_os = "netbsd",
13521368
target_vendor = "apple",

0 commit comments

Comments
 (0)