#ifndef _LIBC_IO_FILE_H_ #define _LIBC_IO_FILE_H_ #include "ringbuf.h" #include #include enum file_flags { FILE_EOF = 0x01u, FILE_ERR = 0x02u, FILE_BIN = 0x04u, FILE_STATIC = 0x08u, }; struct __opaque_file { enum file_flags f_flags; kern_futex_t f_lock; int f_prev; int f_buffer_mode; int f_fd; char f_unget; /* the current seek position of the buffered data (i.e. the offset of * the data that would be returned by reading f_buf). */ size_t f_seek; struct ringbuf f_buf; }; extern void __libc_file_lock(struct __opaque_file *f); extern void __libc_file_unlock(struct __opaque_file *f); extern long __libc_file_read(struct __opaque_file *f, void *p, size_t count); extern long __libc_file_write( struct __opaque_file *f, const void *p, size_t count); #endif