lib: c: io: implement standard FILE and DIR interfaces

This commit is contained in:
2026-03-25 20:21:12 +00:00
parent b975256cb9
commit 96784f611f
21 changed files with 599 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#ifndef _LIBC_IO_FILE_H_
#define _LIBC_IO_FILE_H_
#include <stddef.h>
enum file_flags {
FILE_EOF = 0x01u,
FILE_ERR = 0x02u,
FILE_BIN = 0x04u,
};
struct __opaque_file {
enum file_flags f_flags;
int f_fd;
char f_unget;
char *f_buf;
size_t f_buf_datalen, f_buf_max;
size_t f_buf_readptr;
};
extern int __libc_file_refill(struct __opaque_file *f);
extern int __libc_file_read(struct __opaque_file *f, void *out, size_t count);
extern size_t __libc_file_available(struct __opaque_file *f);
#endif