• R/O
  • HTTP
  • SSH
  • HTTPS

uclibc-ng: Commit


Commit MetaInfo

Revision5a20ac99efe282a233dc2f259876671eab4a10d1 (tree)
Time2016-01-09 15:53:55
AuthorYoshinori Sato <ysato@user...>
CommiterYoshinori Sato

Log Message

revert changes

Change Summary

Incremental Difference

--- a/libc/misc/dirent/readdir.c
+++ b/libc/misc/dirent/readdir.c
@@ -10,16 +10,53 @@
1010 #include <stddef.h>
1111 #include "dirstream.h"
1212
13-#if !defined __ARCH_HAS_DEPRECATED_SYSCALLS__
13+#ifndef __READDIR
1414 # define __READDIR readdir
1515 # define __DIRENT_TYPE struct dirent
1616 # define __GETDENTS __getdents
17+#endif
18+
19+__DIRENT_TYPE *__READDIR(DIR * dir)
20+{
21+ ssize_t bytes;
22+ __DIRENT_TYPE *de;
23+
24+ if (!dir) {
25+ __set_errno(EBADF);
26+ return NULL;
27+ }
28+
29+ __UCLIBC_MUTEX_LOCK(dir->dd_lock);
30+
31+ do {
32+ if (dir->dd_size <= dir->dd_nextloc) {
33+ /* read dir->dd_max bytes of directory entries. */
34+ bytes = __GETDENTS(dir->dd_fd, dir->dd_buf, dir->dd_max);
35+ if (bytes <= 0) {
36+ de = NULL;
37+ goto all_done;
38+ }
39+ dir->dd_size = bytes;
40+ dir->dd_nextloc = 0;
41+ }
42+
43+ de = (__DIRENT_TYPE *) (((char *) dir->dd_buf) + dir->dd_nextloc);
44+
45+ /* Am I right? H.J. */
46+ dir->dd_nextloc += de->d_reclen;
47+
48+ /* We have to save the next offset here. */
49+ dir->dd_nextoff = de->d_off;
1750
18-# include "__readdir.c"
51+ /* Skip deleted files. */
52+ } while (de->d_ino == 0);
1953
54+all_done:
55+ __UCLIBC_MUTEX_UNLOCK(dir->dd_lock);
56+ return de;
57+}
2058 libc_hidden_def(__READDIR)
21-# if WORDSIZE == 64
59+#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
2260 strong_alias_untyped(readdir,readdir64)
2361 libc_hidden_def(readdir64)
24-# endif
2562 #endif
--- a/libc/misc/dirent/readdir64.c
+++ b/libc/misc/dirent/readdir64.c
@@ -6,17 +6,11 @@
66
77 #include <_lfs_64.h>
88 #include <dirent.h>
9-#include <errno.h>
10-#define __need_NULL
11-#include <stddef.h>
12-#include "dirstream.h"
139
14-#define __READDIR readdir64
15-#define __DIRENT_TYPE struct dirent64
16-#define __GETDENTS __getdents64
10+#if __WORDSIZE != 64
11+# define __READDIR readdir64
12+# define __DIRENT_TYPE struct dirent64
13+# define __GETDENTS __getdents64
1714
18-# include "__readdir.c"
19-
20-libc_hidden_def(__READDIR)
21-strong_alias_untyped(readdir64,readdir)
22-libc_hidden_def(readdir)
15+# include "readdir.c"
16+#endif
Show on old repository browser