| |
| |
| |
| |
| |
| |
| #ifndef TPAX_GETDENTS_IMPL_H |
| #define TPAX_GETDENTS_IMPL_H |
| |
| #include <sys/types.h> |
| #include <dirent.h> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #if defined (TPAX_GETDENTS_PORTED) |
| |
| extern long tpax_getdents(int, struct dirent *, size_t); |
| |
| |
| |
| |
| #elif defined (__linux__) || defined (__midipix__) |
| |
| #include <sys/syscall.h> |
| |
| extern long syscall(long, ...); |
| |
| static long tpax_getdents(int fd, struct dirent * dirents, size_t count) |
| { |
| return syscall(SYS_getdents64,fd,dirents,count); |
| } |
| |
| |
| |
| |
| #elif defined (__FreeBSD__) |
| |
| extern ssize_t __sys_getdirentries(int, struct dirent *, size_t, off_t *); |
| |
| static long tpax_getdents(int fd, struct dirent * dirents, size_t count) |
| { |
| return __sys_getdirentries(fd,dirents,count,0); |
| } |
| |
| |
| |
| |
| #else |
| |
| #error tpax: your target requires the emulation of a modern getdents interface. |
| #error tpax: see the top-level PORTING document for additional information. |
| |
| #endif |
| |
| #endif |