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.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c
index f321aeae6..f4fb7476e 100644
--- a/libc/sysdeps/linux/common/getdents.c
+++ b/libc/sysdeps/linux/common/getdents.c
@@ -4,22 +4,17 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <assert.h>
-#include <errno.h>
+#include <sys/syscall.h>
+#include <bits/wordsize.h>
+
+#if !(defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 && __WORDSIZE == 64)
+
#include <dirent.h>
-#include <stddef.h>
-#include <stdint.h>
#include <string.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/param.h>
#include <sys/types.h>
-#include <sys/syscall.h>
#include <bits/kernel_types.h>
#include <bits/kernel-features.h>
-#include <bits/uClibc_alloc.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...
*/
@@ -31,10 +26,6 @@
* version / arch details.
*/
-#ifndef offsetof
-# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
struct kernel_dirent
{
long int d_ino;
@@ -77,6 +68,13 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
#elif ! defined __UCLIBC_HAS_LFS__ || ! defined __NR_getdents64
+# include <assert.h>
+# include <stddef.h>
+# include <errno.h>
+# include <unistd.h>
+# include <sys/param.h>
+# include <bits/uClibc_alloc.h>
+
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
struct dirent *dp;
@@ -138,6 +136,8 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
#elif __WORDSIZE == 32
+# include <stddef.h>
+
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
struct dirent *dp;