From 2572d5b23828082f73c42fa3a12a141a0a04ce45 Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 1 May 2023 20:00:43 +0200 Subject: [PATCH] libc: Add wrapper for the fstatat() system call --- libc/include/sys/stat.h | 3 +++ libc/src/sys/stat.cpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h index f6e76e04..21aaebc3 100644 --- a/libc/include/sys/stat.h +++ b/libc/include/sys/stat.h @@ -29,6 +29,9 @@ extern "C" /* Retrieve information about a file. */ int fstat(int fd, struct stat* st); + /* Retrieve information about a file. */ + int fstatat(int dirfd, const char* path, struct stat* st, int flags); + #ifdef __cplusplus } #endif diff --git a/libc/src/sys/stat.cpp b/libc/src/sys/stat.cpp index 89cb3a45..a33cacf9 100644 --- a/libc/src/sys/stat.cpp +++ b/libc/src/sys/stat.cpp @@ -29,4 +29,10 @@ extern "C" long rc = syscall(SYS_fstatat, fd, "", st, AT_EMPTY_PATH); __errno_return(rc, int); } + + int fstatat(int dirfd, const char* path, struct stat* st, int flags) + { + long rc = syscall(SYS_fstatat, dirfd, path, st, flags); + __errno_return(rc, int); + } }