Skip to content

Commit b9538d0

Browse files
ericktgitbot
authored and
gitbot
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 5ba13a7 commit b9538d0

File tree

1 file changed

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

1 file changed

+17
-1
lines changed

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(
@@ -848,7 +851,6 @@ impl Drop for Dir {
848851
target_os = "vita",
849852
target_os = "hurd",
850853
target_os = "espidf",
851-
target_os = "fuchsia",
852854
target_os = "horizon",
853855
target_os = "vxworks",
854856
target_os = "rtems",
@@ -880,6 +882,7 @@ impl DirEntry {
880882
any(
881883
all(target_os = "linux", not(target_env = "musl")),
882884
target_os = "android",
885+
target_os = "fuchsia",
883886
target_os = "hurd"
884887
),
885888
not(miri) // no dirfd on Miri
@@ -908,6 +911,7 @@ impl DirEntry {
908911
not(any(
909912
all(target_os = "linux", not(target_env = "musl")),
910913
target_os = "android",
914+
target_os = "fuchsia",
911915
target_os = "hurd",
912916
)),
913917
miri
@@ -1211,6 +1215,7 @@ impl File {
12111215
}
12121216
#[cfg(any(
12131217
target_os = "freebsd",
1218+
target_os = "fuchsia",
12141219
target_os = "linux",
12151220
target_os = "android",
12161221
target_os = "netbsd",
@@ -1223,6 +1228,7 @@ impl File {
12231228
}
12241229
#[cfg(not(any(
12251230
target_os = "android",
1231+
target_os = "fuchsia",
12261232
target_os = "freebsd",
12271233
target_os = "linux",
12281234
target_os = "netbsd",
@@ -1238,6 +1244,7 @@ impl File {
12381244

12391245
#[cfg(any(
12401246
target_os = "freebsd",
1247+
target_os = "fuchsia",
12411248
target_os = "linux",
12421249
target_os = "netbsd",
12431250
target_vendor = "apple",
@@ -1249,6 +1256,7 @@ impl File {
12491256

12501257
#[cfg(not(any(
12511258
target_os = "freebsd",
1259+
target_os = "fuchsia",
12521260
target_os = "linux",
12531261
target_os = "netbsd",
12541262
target_vendor = "apple",
@@ -1259,6 +1267,7 @@ impl File {
12591267

12601268
#[cfg(any(
12611269
target_os = "freebsd",
1270+
target_os = "fuchsia",
12621271
target_os = "linux",
12631272
target_os = "netbsd",
12641273
target_vendor = "apple",
@@ -1270,6 +1279,7 @@ impl File {
12701279

12711280
#[cfg(not(any(
12721281
target_os = "freebsd",
1282+
target_os = "fuchsia",
12731283
target_os = "linux",
12741284
target_os = "netbsd",
12751285
target_vendor = "apple",
@@ -1280,6 +1290,7 @@ impl File {
12801290

12811291
#[cfg(any(
12821292
target_os = "freebsd",
1293+
target_os = "fuchsia",
12831294
target_os = "linux",
12841295
target_os = "netbsd",
12851296
target_vendor = "apple",
@@ -1297,6 +1308,7 @@ impl File {
12971308

12981309
#[cfg(not(any(
12991310
target_os = "freebsd",
1311+
target_os = "fuchsia",
13001312
target_os = "linux",
13011313
target_os = "netbsd",
13021314
target_vendor = "apple",
@@ -1307,6 +1319,7 @@ impl File {
13071319

13081320
#[cfg(any(
13091321
target_os = "freebsd",
1322+
target_os = "fuchsia",
13101323
target_os = "linux",
13111324
target_os = "netbsd",
13121325
target_vendor = "apple",
@@ -1324,6 +1337,7 @@ impl File {
13241337

13251338
#[cfg(not(any(
13261339
target_os = "freebsd",
1340+
target_os = "fuchsia",
13271341
target_os = "linux",
13281342
target_os = "netbsd",
13291343
target_vendor = "apple",
@@ -1334,6 +1348,7 @@ impl File {
13341348

13351349
#[cfg(any(
13361350
target_os = "freebsd",
1351+
target_os = "fuchsia",
13371352
target_os = "linux",
13381353
target_os = "netbsd",
13391354
target_vendor = "apple",
@@ -1345,6 +1360,7 @@ impl File {
13451360

13461361
#[cfg(not(any(
13471362
target_os = "freebsd",
1363+
target_os = "fuchsia",
13481364
target_os = "linux",
13491365
target_os = "netbsd",
13501366
target_vendor = "apple",

0 commit comments

Comments
 (0)