2 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
4 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
14 #include "dirstream.h"
16 /* libc_hidden_proto(readdir64) */
17 struct dirent64 *readdir64(DIR * dir)
27 __UCLIBC_MUTEX_LOCK(dir->dd_lock);
30 if (dir->dd_size <= dir->dd_nextloc) {
31 /* read dir->dd_max bytes of directory entries. */
32 bytes = __getdents64(dir->dd_fd, dir->dd_buf, dir->dd_max);
41 de = (struct dirent64 *) (((char *) dir->dd_buf) + dir->dd_nextloc);
43 /* Am I right? H.J. */
44 dir->dd_nextloc += de->d_reclen;
46 /* We have to save the next offset here. */
47 dir->dd_nextoff = de->d_off;
49 /* Skip deleted files. */
50 } while (de->d_ino == 0);
53 __UCLIBC_MUTEX_UNLOCK(dir->dd_lock);
57 libc_hidden_def(readdir64)