|
1 | 1 | /*
|
2 | 2 | * Copyright (c) 2018 Intel Corporation
|
| 3 | + * Copyright (c) 2024 Tenstorrent AI ULC |
3 | 4 | *
|
4 | 5 | * SPDX-License-Identifier: Apache-2.0
|
5 | 6 | */
|
| 7 | + |
6 | 8 | #ifndef ZEPHYR_INCLUDE_POSIX_DIRENT_H_
|
7 | 9 | #define ZEPHYR_INCLUDE_POSIX_DIRENT_H_
|
8 | 10 |
|
9 |
| -#include <limits.h> |
10 |
| - |
11 |
| -#include <zephyr/posix/posix_types.h> |
12 |
| - |
13 |
| -#ifdef CONFIG_POSIX_FILE_SYSTEM |
14 |
| -#include <zephyr/fs/fs.h> |
| 11 | +#include <zephyr/posix/sys/dirent.h> |
| 12 | +#include <zephyr/toolchain.h> |
15 | 13 |
|
16 | 14 | #ifdef __cplusplus
|
17 | 15 | extern "C" {
|
18 | 16 | #endif
|
19 | 17 |
|
20 |
| -typedef void DIR; |
21 |
| - |
22 |
| -struct dirent { |
23 |
| - unsigned int d_ino; |
24 |
| - char d_name[PATH_MAX + 1]; |
25 |
| -}; |
26 |
| - |
27 |
| -/* Directory related operations */ |
28 |
| -DIR *opendir(const char *dirname); |
| 18 | +#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) |
| 19 | +int alphasort(const struct dirent **d1, const struct dirent **d2); |
| 20 | +#endif |
29 | 21 | int closedir(DIR *dirp);
|
| 22 | +#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) |
| 23 | +int dirfd(DIR *dirp); |
| 24 | +#endif |
| 25 | +DIR *fdopendir(int fd); |
| 26 | +DIR *opendir(const char *dirname); |
30 | 27 | struct dirent *readdir(DIR *dirp);
|
| 28 | +#if (_POSIX_C_SOURCE >= 199506L) || (_XOPEN_SOURCE >= 500) |
31 | 29 | int readdir_r(DIR *ZRESTRICT dirp, struct dirent *ZRESTRICT entry,
|
32 | 30 | struct dirent **ZRESTRICT result);
|
| 31 | +#endif |
| 32 | +void rewinddir(DIR *dirp); |
| 33 | +#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) |
| 34 | +int scandir(const char *dir, struct dirent ***namelist, int (*sel)(const struct dirent *), |
| 35 | + int (*compar)(const struct dirent **, const struct dirent **)); |
| 36 | +#endif |
| 37 | +#if defined(_XOPEN_SOURCE) |
| 38 | +void seekdir(DIR *dirp, long loc); |
| 39 | +long telldir(DIR *dirp); |
| 40 | +#endif |
33 | 41 |
|
34 | 42 | #ifdef __cplusplus
|
35 | 43 | }
|
36 | 44 | #endif
|
37 | 45 |
|
38 |
| -#endif /* CONFIG_POSIX_FILE_SYSTEM */ |
39 |
| - |
40 |
| -#endif /* ZEPHYR_INCLUDE_POSIX_DIRENT_H_ */ |
| 46 | +#endif /* ZEPHYR_INCLUDE_POSIX_DIRENT_H_ */ |
0 commit comments