summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/getdents.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/getdents.c')
-rw-r--r--libc/sysdeps/linux/common/getdents.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c
index e1aa2a51f..6a38772e8 100644
--- a/libc/sysdeps/linux/common/getdents.c
+++ b/libc/sysdeps/linux/common/getdents.c
@@ -18,6 +18,11 @@
#include <bits/kernel_types.h>
#include <bits/kernel-features.h>
+#if !(defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 && __WORDSIZE == 64)
+/* If the condition above is met, __getdents is defined as an alias
+ * for __getdents64 (see getdents64.c). Otherwise...
+ */
+
/* With newer versions of linux, the getdents syscall returns d_type
* information after the name field.
*
@@ -42,7 +47,8 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes) attribute_hidden;
#define __NR___syscall_getdents __NR_getdents
static __always_inline _syscall3(int, __syscall_getdents, int, fd, unsigned char *, kdirp, size_t, count)
-#ifdef __ASSUME_GETDENTS32_D_TYPE
+#if defined __ASSUME_GETDENTS32_D_TYPE
+
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
ssize_t retval;
@@ -72,9 +78,6 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
#elif ! defined __UCLIBC_HAS_LFS__ || ! defined __NR_getdents64
-/* Experimentally off - libc_hidden_proto(memcpy) */
-/* libc_hidden_proto(lseek) */
-
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
struct dirent *dp;
@@ -136,8 +139,6 @@ attribute_hidden strong_alias(__getdents,__getdents64)
#elif __WORDSIZE == 32
-/* Experimentally off - libc_hidden_proto(memmove) */
-
extern __typeof(__getdents) __getdents64 attribute_hidden;
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
@@ -165,3 +166,5 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
}
#endif
+
+#endif