[prev in list] [next in list] [prev in thread] [next in thread] 

List:       uclibc
Subject:    [RFC PATCH 32/38] stat: prefer fstatat64 syscall
From:       jonas () southpole ! se (Jonas Bonn)
Date:       2011-09-06 8:30:56
Message-ID: 90e2484e091b1ce650ccc121ac0f4ffb9cb8f2fa.1315297676.git.jonas () southpole ! se
[Download RAW message or body]


Signed-off-by: Jonas Bonn <jonas at southpole.se>
---
 libc/sysdeps/linux/common/stat.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/libc/sysdeps/linux/common/stat.c b/libc/sysdeps/linux/common/stat.c
index a6ab291..8cc0928 100644
--- a/libc/sysdeps/linux/common/stat.c
+++ b/libc/sysdeps/linux/common/stat.c
@@ -9,9 +9,18 @@
 
 #include <sys/syscall.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include <sys/stat.h>
 #include "xstatconv.h"
 
+#ifdef __NR_fstatat64
+int stat(const char *file_name, struct stat *buf)
+{
+	return fstatat(AT_FDCWD, file_name, buf, 0);
+}
+
+#else
+
 #define __NR___syscall_stat __NR_stat
 #undef stat
 static __inline__ _syscall2(int, __syscall_stat,
@@ -28,9 +37,12 @@ int stat(const char *file_name, struct stat *buf)
 	}
 	return result;
 }
+
+#endif
+
 libc_hidden_def(stat)
 
-#if ! defined __NR_stat64 && defined __UCLIBC_HAS_LFS__
+#if ! defined __NR_stat64 && ! defined __NR_fstatat64 && defined __UCLIBC_HAS_LFS__
 strong_alias_untyped(stat,stat64)
 libc_hidden_def(stat64)
 #endif
-- 
1.7.5.4


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic