diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-11-10 13:47:02 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-11-10 13:51:27 +0100 |
commit | 18348cebf1f2954741790d4c2bc2f8ff1658f8a3 (patch) | |
tree | be7ef84ff8f53d1cb627a02002b2c91d33b0a831 /Kernel/UnixTypes.h | |
parent | 4f277451362fdbb9f6930e57c50d3c2d0bbf45e5 (diff) | |
download | serenity-18348cebf1f2954741790d4c2bc2f8ff1658f8a3.zip |
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.
Diffstat (limited to 'Kernel/UnixTypes.h')
-rw-r--r-- | Kernel/UnixTypes.h | 3 |
1 files changed, 3 insertions, 0 deletions
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 + |