2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 /* These two are needed for some definitions in emul_host.h */
7 #include <sys/select.h>
8 #include <sys/statfs.h>
10 /* This prevents redefinition of struct timeval */
11 #define _AROS_TYPES_TIMEVAL_S_H_
13 #include <aros/debug.h>
15 #include "emul_intern.h"
16 #include "emul_unix.h"
18 #define is_special_dir(x) (x[0] == '.' && (!x[1] || (x[1] == '.' && !x[2])))
21 * Bionic lacks seekdir() and telldir(), so we use the same approach as
22 * in Windows version. See comments there for explaination.
24 struct dirent
*ReadDir(struct emulbase
*emulbase
, struct filehandle
*fh
, IPTR
*dirpos
)
28 D(bug("[emul] Current dirpos %lu, requested %lu\n", fh
->ph
.dirpos
, *dirpos
));
29 if (fh
->ph
.dirpos
> *dirpos
)
31 D(bug("[emul] Resetting search handle\n"));
33 /* The same as DoRewindDir(), just do not torture a semaphore */
34 emulbase
->pdata
.SysIFace
->rewinddir(fh
->fd
);
42 dir
= emulbase
->pdata
.SysIFace
->readdir(fh
->fd
);
47 D(bug("[emul] Found %s, position %lu\n", dir
->d_name
, fh
->ph
.dirpos
));
48 } while (fh
->ph
.dirpos
<= *dirpos
);
51 D(bug("[emul] New dirpos: %lu\n", *dirpos
));
53 } while (is_special_dir(dir
->d_name
));