|
14 | 14 | #include <zephyr/kernel.h>
|
15 | 15 | #include <zephyr/sys/util.h>
|
16 | 16 |
|
| 17 | +/* FIXME: use k_off_t and k_ssize_t to avoid the POSIX->Zephyr->POSIX dependency cycle */ |
| 18 | +#ifdef CONFIG_NEWLIB_LIBC |
| 19 | +#ifndef _OFF_T_DECLARED |
| 20 | +typedef _off_t off_t; |
| 21 | +#define _OFF_T_DECLARED |
| 22 | +#endif |
| 23 | +#ifndef _SSIZE_T_DECLARED |
| 24 | +typedef _ssize_t ssize_t; |
| 25 | +#define _SSIZE_T_DECLARED |
| 26 | +#endif |
| 27 | +#endif |
| 28 | + |
| 29 | +#include <stdio.h> |
| 30 | + |
17 | 31 | #ifdef CONFIG_PICOLIBC
|
18 | 32 | #define ZVFS_O_APPEND 0x0400
|
19 | 33 | #define ZVFS_O_CREAT 0x0040
|
|
60 | 74 | extern "C" {
|
61 | 75 | #endif
|
62 | 76 |
|
63 |
| -/* FIXME: use k_off_t and k_ssize_t to avoid the POSIX->Zephyr->POSIX dependency cycle */ |
64 |
| -#ifdef CONFIG_NEWLIB_LIBC |
65 |
| -#ifndef _OFF_T_DECLARED |
66 |
| -typedef __off_t off_t; |
67 |
| -#define _OFF_T_DECLARED |
68 |
| -#endif |
69 |
| -#ifndef _SSIZE_T_DECLARED |
70 |
| -typedef _ssize_t ssize_t; |
71 |
| -#define _SSIZE_T_DECLARED |
72 |
| -#endif |
73 |
| -#endif |
74 |
| - |
75 | 77 | /**
|
76 | 78 | * File descriptor virtual method table.
|
77 | 79 | * Currently all operations beyond read/write/close go thru ioctl method.
|
@@ -261,6 +263,12 @@ __syscall int zvfs_select(int nfds, struct zvfs_fd_set *ZRESTRICT readfds,
|
261 | 263 | struct zvfs_fd_set *ZRESTRICT errorfds,
|
262 | 264 | const struct timespec *ZRESTRICT timeout, const void *ZRESTRICT sigmask);
|
263 | 265 |
|
| 266 | +void zvfs_libc_file_alloc_cb(int fd, const char *mode, FILE *fp); |
| 267 | +int zvfs_libc_file_alloc(int fd, const char *mode, FILE **fp, k_timeout_t timeout); |
| 268 | +void zvfs_libc_file_free(FILE *fp); |
| 269 | +int zvfs_libc_file_get_fd(FILE *fp); |
| 270 | +FILE *zvfs_libc_file_from_fd(int fd); |
| 271 | + |
264 | 272 | /**
|
265 | 273 | * Request codes for fd_op_vtable.ioctl().
|
266 | 274 | *
|
|
0 commit comments