commit 3244819714e6cd3c90481ac41624835958136e49
parent 8baed5bc1f99b17a9002d3a14db1ede5681a2f40
Author: Drew DeVault <sir@cmpwn.com>
Date: Sat, 20 Mar 2021 12:48:55 -0400
Fix O_DIRECTORY on +aarch64
Diffstat:
4 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/os/+linux/dirfdfs.ha b/os/+linux/dirfdfs.ha
@@ -147,6 +147,12 @@ fn fs_open(
oflags |= flags[i]: int;
};
+ if ((oflags: fs::flags & fs::flags::DIRECTORY) == fs::flags::DIRECTORY) {
+ // This is arch-specific
+ oflags &= ~fs::flags::DIRECTORY: int;
+ oflags |= rt::O_DIRECTORY: int;
+ };
+
if ((oflags: fs::flags & fs::flags::RDWR) == fs::flags::RDWR) {
iomode = io::mode::RDWR;
} else if ((oflags: fs::flags & fs::flags::WRONLY) == fs::flags::WRONLY) {
diff --git a/rt/+linux/+aarch64.ha b/rt/+linux/+aarch64.ha
@@ -20,3 +20,5 @@ export fn clone(
err: errno => err,
};
};
+
+export def O_DIRECTORY: int = 0o40000;
diff --git a/rt/+linux/+x86_64.ha b/rt/+linux/+x86_64.ha
@@ -20,3 +20,5 @@ export fn clone(
err: errno => err,
};
};
+
+export def O_DIRECTORY: int = 0o40000;
diff --git a/rt/+linux/types.ha b/rt/+linux/types.ha
@@ -47,6 +47,7 @@ export def AT_STATX_FORCE_SYNC: int = 0x2000;
export def AT_STATX_DONT_SYNC: int = 0x4000;
export def AT_RECURSIVE: int = 0x8000;
+// O_DIRECTORY is arch specific
export def O_RDONLY: int = 0o0;
export def O_WRONLY: int = 0o1;
export def O_RDWR: int = 0o2;
@@ -59,7 +60,6 @@ export def O_NONBLOCK: int = 0o4000;
export def O_DSYNC: int = 0o10000;
export def O_SYNC: int = 0o4010000;
export def O_RSYNC: int = 0o4010000;
-export def O_DIRECTORY: int = 0o200000;
export def O_NOFOLLOW: int = 0o400000;
export def O_NOATIME: int = 0o1000000;
export def O_CLOEXEC: int = 0o2000000;