2020-06-15 14:18:57 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_DIRENT_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_DIRENT_H_
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
2022-08-13 20:11:56 +00:00
|
|
|
COSMOPOLITAN_C_START_
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2021-01-29 09:25:14 +00:00
|
|
|
struct dirent { /* linux getdents64 abi */
|
2020-06-15 14:18:57 +00:00
|
|
|
uint64_t d_ino; /* inode number */
|
|
|
|
int64_t d_off; /* implementation-dependent location number */
|
|
|
|
uint16_t d_reclen; /* byte length of this whole struct and string */
|
2021-06-24 19:31:26 +00:00
|
|
|
uint8_t d_type; /* DT_REG, DT_DIR, DT_UNKNOWN, DT_BLK, etc. */
|
2020-09-07 04:39:00 +00:00
|
|
|
char d_name[256]; /* NUL-terminated basename */
|
2020-06-15 14:18:57 +00:00
|
|
|
};
|
|
|
|
|
2021-02-08 17:19:00 +00:00
|
|
|
struct dirstream;
|
|
|
|
typedef struct dirstream DIR;
|
|
|
|
|
2022-06-09 03:01:28 +00:00
|
|
|
DIR *fdopendir(int) dontdiscard;
|
|
|
|
DIR *opendir(const char *) dontdiscard;
|
|
|
|
int closedir(DIR *);
|
|
|
|
int dirfd(DIR *);
|
|
|
|
long telldir(DIR *);
|
|
|
|
struct dirent *readdir(DIR *);
|
2022-10-11 00:52:41 +00:00
|
|
|
int readdir_r(DIR *, struct dirent *, struct dirent **);
|
2022-06-09 03:01:28 +00:00
|
|
|
void rewinddir(DIR *);
|
2022-08-07 00:18:40 +00:00
|
|
|
void seekdir(DIR *, long);
|
2022-10-11 00:52:41 +00:00
|
|
|
int alphasort(const struct dirent **, const struct dirent **);
|
|
|
|
int versionsort(const struct dirent **, const struct dirent **);
|
|
|
|
int scandir(const char *, struct dirent ***, int (*)(const struct dirent *),
|
|
|
|
int (*)(const struct dirent **, const struct dirent **));
|
2022-06-09 03:01:28 +00:00
|
|
|
|
2022-08-13 20:11:56 +00:00
|
|
|
COSMOPOLITAN_C_END_
|
2020-06-15 14:18:57 +00:00
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_DIRENT_H_ */
|