summaryrefslogtreecommitdiff
path: root/lib/openat.h
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-09-07 05:28:13 -0600
committerEric Blake <ebb9@byu.net>2009-09-07 05:28:13 -0600
commit370fec14f2e177cf533cb967e2dc04354e883c45 (patch)
tree788dd4fddf9a094c7ee3c9866c68d62e7e3206a7 /lib/openat.h
parentd4356ced2b562ac55101ab23a5321114c41e0eda (diff)
downloadgnulib-370fec14f2e177cf533cb967e2dc04354e883c45.tar.gz
openat: provide more convenience names
* modules/faccessat (configure.ac): Add C witness. * lib/unistd.in.h (readlinkat): Fix typo. * lib/openat.h (statat, lstatat, accessat, euidaccessat): New convenience wrappers. * top/maint.mk (sc_prohibit_openat_without_use): Allow these wrappers in syntax checks. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'lib/openat.h')
-rw-r--r--lib/openat.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/openat.h b/lib/openat.h
index 1d8596fd86..433b9983df 100644
--- a/lib/openat.h
+++ b/lib/openat.h
@@ -81,4 +81,34 @@ lchmodat (int fd, char const *file, mode_t mode)
return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW);
}
+static inline int
+statat (int fd, char const *name, struct stat *st)
+{
+ return fstatat (fd, name, st, 0);
+}
+
+static inline int
+lstatat (int fd, char const *name, struct stat *st)
+{
+ return fstatat (fd, name, st, AT_SYMLINK_NOFOLLOW);
+}
+
+#if GNULIB_FACCESSAT
+/* For now, there are no wrappers named laccessat or leuidaccessat,
+ since gnulib doesn't support faccessat(,AT_SYMLINK_NOFOLLOW) and
+ since access rights on symlinks are of limited utility. */
+
+static inline int
+accessat (int fd, char const *file, int mode)
+{
+ return faccessat (fd, file, mode, 0);
+}
+
+static inline int
+euidaccessat (int fd, char const *file, int mode)
+{
+ return faccessat (fd, file, mode, AT_EACCESS);
+}
+#endif
+
#endif /* _GL_HEADER_OPENAT */