summaryrefslogtreecommitdiff
path: root/libc/misc/dirent
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/dirent')
-rw-r--r--libc/misc/dirent/Makefile.in7
-rw-r--r--libc/misc/dirent/alphasort64.c4
-rw-r--r--libc/misc/dirent/dirstream.h2
-rw-r--r--libc/misc/dirent/readdir.c3
-rw-r--r--libc/misc/dirent/readdir64.c5
-rw-r--r--libc/misc/dirent/readdir64_r.c5
-rw-r--r--libc/misc/dirent/scandir64.c4
7 files changed, 13 insertions, 17 deletions
diff --git a/libc/misc/dirent/Makefile.in b/libc/misc/dirent/Makefile.in
index ee0165e38..e1dfa3d94 100644
--- a/libc/misc/dirent/Makefile.in
+++ b/libc/misc/dirent/Makefile.in
@@ -7,8 +7,11 @@
#
CSRC:= alphasort.c closedir.c dirfd.c opendir.c readdir.c rewinddir.c scandir.c \
- seekdir.c telldir.c readdir64.c alphasort64.c scandir64.c readdir_r.c \
- readdir64_r.c
+ seekdir.c telldir.c readdir_r.c
+
+ifeq ($(UCLIBC_HAS_LFS),y)
+CSRC+= readdir64.c alphasort64.c scandir64.c readdir64_r.c
+endif
MISC_DIRENT_DIR:=$(top_srcdir)libc/misc/dirent
MISC_DIRENT_OUT:=$(top_builddir)libc/misc/dirent
diff --git a/libc/misc/dirent/alphasort64.c b/libc/misc/dirent/alphasort64.c
index 5801f4940..c6cfcdacf 100644
--- a/libc/misc/dirent/alphasort64.c
+++ b/libc/misc/dirent/alphasort64.c
@@ -1,5 +1,5 @@
#include <features.h>
-#ifdef __UCLIBC_HAS_LFS__
+
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
#undef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
@@ -22,5 +22,3 @@ int alphasort64(const void * a, const void * b)
return __strcmp ((*(const struct dirent64 **) a)->d_name,
(*(const struct dirent64 **) b)->d_name);
}
-#endif /* __UCLIBC_HAS_LFS__ */
-
diff --git a/libc/misc/dirent/dirstream.h b/libc/misc/dirent/dirstream.h
index a90ca6312..15c70858f 100644
--- a/libc/misc/dirent/dirstream.h
+++ b/libc/misc/dirent/dirstream.h
@@ -72,8 +72,10 @@ struct __dirstream {
extern ssize_t __getdents(int fd, char *buf, size_t count) attribute_hidden;
+extern struct dirent *__readdir (DIR *__dirp) __nonnull ((1)) attribute_hidden;
#ifdef __UCLIBC_HAS_LFS__
extern ssize_t __getdents64 (int fd, char *buf, size_t count) attribute_hidden;
+extern struct dirent64 *__readdir64 (DIR *__dirp) __nonnull ((1)) attribute_hidden;
#endif
#endif /* dirent.h */
diff --git a/libc/misc/dirent/readdir.c b/libc/misc/dirent/readdir.c
index 48d065f68..2d4ad4aeb 100644
--- a/libc/misc/dirent/readdir.c
+++ b/libc/misc/dirent/readdir.c
@@ -1,3 +1,5 @@
+#include <features.h>
+
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -5,7 +7,6 @@
#include <dirent.h>
#include "dirstream.h"
-#undef readdir
struct dirent attribute_hidden *__readdir(DIR * dir)
{
ssize_t bytes;
diff --git a/libc/misc/dirent/readdir64.c b/libc/misc/dirent/readdir64.c
index 51918e363..177af3fc9 100644
--- a/libc/misc/dirent/readdir64.c
+++ b/libc/misc/dirent/readdir64.c
@@ -1,5 +1,5 @@
#include <features.h>
-#ifdef __UCLIBC_HAS_LFS__
+
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
#undef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
@@ -20,7 +20,6 @@
#include <dirent.h>
#include "dirstream.h"
-#undef readdir64
struct dirent64 attribute_hidden *__readdir64(DIR * dir)
{
ssize_t bytes;
@@ -62,5 +61,3 @@ all_done:
return de;
}
strong_alias(__readdir64,readdir64)
-
-#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/misc/dirent/readdir64_r.c b/libc/misc/dirent/readdir64_r.c
index 7daf890dd..1cbaf3156 100644
--- a/libc/misc/dirent/readdir64_r.c
+++ b/libc/misc/dirent/readdir64_r.c
@@ -1,5 +1,5 @@
#include <features.h>
-#ifdef __UCLIBC_HAS_LFS__
+
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
#undef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
@@ -19,7 +19,6 @@
#include <dirent.h>
#include "dirstream.h"
-
int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result)
{
int ret;
@@ -69,5 +68,3 @@ all_done:
__pthread_mutex_unlock(&(dir->dd_lock));
return((de != NULL)? 0 : ret);
}
-#endif /* __UCLIBC_HAS_LFS__ */
-
diff --git a/libc/misc/dirent/scandir64.c b/libc/misc/dirent/scandir64.c
index 7a661996b..e77b88d3c 100644
--- a/libc/misc/dirent/scandir64.c
+++ b/libc/misc/dirent/scandir64.c
@@ -25,7 +25,7 @@
#define closedir __closedir
#include <features.h>
-#ifdef __UCLIBC_HAS_LFS__
+
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
#undef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
@@ -114,5 +114,3 @@ int scandir64(const char *dir, struct dirent64 ***namelist,
*namelist = names;
return pos;
}
-#endif /* __UCLIBC_HAS_LFS__ */
-