commit 6a0b8841e0de10197cdee99296d59160c7c238b7
parent b3ee22310122a141475760fd30e77190785a614b
Author: illiliti <illiliti@dimension.sh>
Date: Mon, 7 Aug 2023 05:24:12 +0300
rt+freebsd: add fstat, AT_EMPTY_PATH, S_IF*
Signed-off-by: illiliti <illiliti@dimension.sh>
Diffstat:
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/rt/+freebsd/syscalls.ha b/rt/+freebsd/syscalls.ha
@@ -152,6 +152,9 @@ export fn fstatat(fd: int, path: path, stat: *st, flag: int) (void | errno) = {
stat.flags = fbstat.st_flags;
};
+export fn fstat(fd: int, stat: *st) (errno | void) =
+ fstatat(fd, "", stat, AT_EMPTY_PATH);
+
export fn readlinkat(
dirfd: int,
path: path,
diff --git a/rt/+freebsd/types.ha b/rt/+freebsd/types.ha
@@ -308,6 +308,15 @@ export def AT_SYMLINK_NOFOLLOW: int = 0x0200;
export def AT_SYMLINK_FOLLOW: int = 0x0400;
export def AT_REMOVEDIR: int = 0x0800;
export def AT_RESOLVE_BENEATH: int = 0x2000;
+export def AT_EMPTY_PATH: int = 0x4000;
+
+export def S_IFIFO: mode_t = 0o010000;
+export def S_IFCHR: mode_t = 0o020000;
+export def S_IFDIR: mode_t = 0o040000;
+export def S_IFBLK: mode_t = 0o060000;
+export def S_IFREG: mode_t = 0o100000;
+export def S_IFLNK: mode_t = 0o120000;
+export def S_IFSOCK: mode_t = 0o140000;
export def MAP_SHARED: uint = 0x0001;
export def MAP_PRIVATE: uint = 0x0002;