From 18348cebf1f2954741790d4c2bc2f8ff1658f8a3 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 10 Nov 2019 13:47:02 +0100 Subject: Kernel+LibC: Implement the openat() syscall POSIX's openat() is very similar to open(), except you also provide a file descriptor referring to a directory from which relative paths should be resolved. Passing it the magical fd number AT_FDCWD means "resolve from current directory" (which is indeed also what open() normally does.) This fixes libarchive's bsdtar, since it was trying to do something extremely wrong in the absence of openat() support. The issue has recently been fixed upstream in libarchive: https://github.com/libarchive/libarchive/issues/1239 However, we should have openat() support anyway, so I went ahead and implemented it. :^) Fixes #748. --- Kernel/UnixTypes.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Kernel/UnixTypes.h') diff --git a/Kernel/UnixTypes.h b/Kernel/UnixTypes.h index 52122f8727..e50bfc0cb6 100644 --- a/Kernel/UnixTypes.h +++ b/Kernel/UnixTypes.h @@ -448,3 +448,6 @@ struct ifreq { #define ifr_llprio ifr_ifru.ifru_metric // link layer priority #define ifr_hwaddr ifr_ifru.ifru_hwaddr // MAC address }; + +#define AT_FDCWD -100 + -- cgit v1.2.3