This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
[PATCH][alpha] Fix fxstatat for recent kernels
- From: Aurelien Jarno <aurelien at aurel32 dot net>
- To: libc-ports at sourceware dot org
- Date: Fri, 11 Mar 2011 18:03:46 +0100
- Subject: [PATCH][alpha] Fix fxstatat for recent kernels
When compiling GLIBC for recent kernels, __ASSUME_ATFCTS is set and thus
__atfct_seterrno() is not defined. This breaks fxstatat() on alpha,
which tries to use the old syscalls unconditionally.
This patch fixes the issue by adding support for the fstatat64 syscall
in __fxstatat().
2011-03-11 Aurelien Jarno <aurelien@aurel32.net>
* sysdeps/unix/sysv/linux/alpha/fxstatat.c(__fxstatat): use fstatat64
syscall when available.
diff --git a/sysdeps/unix/sysv/linux/alpha/fxstatat.c b/sysdeps/unix/sysv/linux/alpha/fxstatat.c
index 6fa3aeb..516f962 100644
--- a/sysdeps/unix/sysv/linux/alpha/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/alpha/fxstatat.c
@@ -35,6 +35,32 @@
int
__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
{
+ int result;
+ INTERNAL_SYSCALL_DECL (err);
+
+#ifdef __NR_fstatat64
+# ifndef __ASSUME_ATFCTS
+ if (__have_atfcts >= 0)
+# endif
+ {
+ result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, st, flag);
+# ifndef __ASSUME_ATFCTS
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)
+ && INTERNAL_SYSCALL_ERRNO (result, err) == ENOSYS)
+ __have_atfcts = -1;
+ else
+# endif
+ if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return 0;
+ else
+ {
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+ return -1;
+ }
+ }
+#endif
+
+#ifndef __ASSUME_ATFCTS
if (flag & ~AT_SYMLINK_NOFOLLOW)
{
__set_errno (EINVAL);
@@ -68,7 +94,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
}
INTERNAL_SYSCALL_DECL (err);
- int result, errno_out;
+ int errno_out;
struct kernel_stat kst;
#if __ASSUME_STAT64_SYSCALL > 0
@@ -114,6 +140,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
__atfct_seterrno (errno_out, fd, buf);
return -1;
+#endif
}
libc_hidden_def (__fxstatat)
strong_alias (__fxstatat, __fxstatat64);
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net