|
PatchworkOS
|
Go to the source code of this file.
Data Structures | |
| struct | fpos_t |
| struct | FILE |
Macros | |
| #define | _UNGETC_MAX 64 |
| #define | _FILE_GETC(stream) |
| #define | _FILE_CHECK_AVAIL(fh) (((fh->bufIndex == fh->bufEnd) && (fh->ungetIndex == 0)) ? _file_fill_buffer(fh) : 0) |
Enumerations | |
| enum | _file_flags_t { _FILE_READ = (1 << 0) , _FILE_WRITE = (1 << 2) , _FILE_RW = (1 << 3) , _FILE_APPEND = (1 << 4) , _FILE_BIN = (1 << 5) , _FILE_OWNS_BUFFER = (1 << 6) , _FILE_FULLY_BUFFERED = (1 << 7) , _FILE_LINE_BUFFERED = (1 << 8) , _FILE_UNBUFFERED = (1 << 9) , _FILE_ERROR = (1 << 10) , _FILE_WIDESTREAM = (1 << 11) , _FILE_BYTESTREAM = (1 << 12) , _FILE_DELETE_ON_CLOSE = (1 << 13) , _FILE_EOF = (1 << 14) } |
Functions | |
| _file_flags_t | _file_flags_parse (const char *mode) |
| FILE * | _file_new (void) |
| void | _file_free (FILE *stream) |
| uint64_t | _file_init (FILE *stream, fd_t fd, _file_flags_t flags, void *buffer, uint64_t bufferSize) |
| void | _file_deinit (FILE *stream) |
| uint64_t | _file_flush_buffer (FILE *stream) |
| uint64_t | _file_fill_buffer (FILE *stream) |
| uint64_t | _file_seek (FILE *stream, int64_t offset, int whence) |
| uint64_t | _file_prepare_read (FILE *stream) |
| uint64_t | _file_prepare_write (FILE *stream) |
| void | _files_init (void) |
| void | _files_push (FILE *file) |
| void | _files_remove (FILE *file) |
| void | _files_close (void) |
| uint64_t | _files_flush (void) |
| #define _FILE_CHECK_AVAIL | ( | fh | ) | (((fh->bufIndex == fh->bufEnd) && (fh->ungetIndex == 0)) ? _file_fill_buffer(fh) : 0) |
| #define _FILE_GETC | ( | stream | ) |
| enum _file_flags_t |
| void _file_deinit | ( | FILE * | stream | ) |
Definition at line 146 of file file.c.
References _FILE_OWNS_BUFFER, FILE::buf, close(), FILE::fd, FILE::flags, free(), FILE::mtx, and mtx_destroy().
Referenced by fclose().
Definition at line 177 of file file.c.
References _FILE_BIN, _FILE_EOF, _FILE_ERROR, FILE::buf, FILE::bufEnd, FILE::bufIndex, FILE::bufSize, count, ERR, FILE::fd, FILE::flags, fpos_t::offset, FILE::pos, and read().
| _file_flags_t _file_flags_parse | ( | const char * | mode | ) |
Definition at line 12 of file file.c.
References _FILE_APPEND, _FILE_BIN, _FILE_READ, _FILE_RW, _FILE_WRITE, files, and NULL.
Referenced by fopen().
Definition at line 158 of file file.c.
References _FILE_BIN, _FILE_ERROR, FILE::buf, FILE::bufIndex, count, ERR, FILE::fd, FILE::flags, fpos_t::offset, FILE::pos, and write().
Referenced by fclose(), fflush(), fputc(), fputs(), fseek(), fwrite(), puts(), and vfprintf().
| void _file_free | ( | FILE * | stream | ) |
| uint64_t _file_init | ( | FILE * | stream, |
| fd_t | fd, | ||
| _file_flags_t | flags, | ||
| void * | buffer, | ||
| uint64_t | bufferSize | ||
| ) |
Definition at line 100 of file file.c.
References _FILE_OWNS_BUFFER, FILE::buf, FILE::bufEnd, buffer, FILE::bufIndex, FILE::bufSize, ERR, FILE::fd, FILE::flags, free(), malloc(), FILE::mtx, mtx_init(), mtx_recursive, NULL, fpos_t::offset, FILE::pos, fpos_t::status, thrd_success, and FILE::ungetIndex.
Referenced by _std_stream_init(), and fopen().
| FILE * _file_new | ( | void | ) |
Definition at line 80 of file file.c.
References calloc(), FILE::entry, list_entry_init(), and NULL.
Referenced by fopen().
Definition at line 224 of file file.c.
References _FILE_APPEND, _FILE_BYTESTREAM, _FILE_EOF, _FILE_ERROR, _FILE_READ, _FILE_RW, _FILE_WIDESTREAM, _FILE_WRITE, FILE::bufEnd, FILE::bufIndex, EBADF, ERR, errno, and FILE::flags.
Definition at line 239 of file file.c.
References _FILE_APPEND, _FILE_BYTESTREAM, _FILE_EOF, _FILE_ERROR, _FILE_READ, _FILE_RW, _FILE_WIDESTREAM, _FILE_WRITE, FILE::bufEnd, FILE::bufIndex, EBADF, ERR, errno, FILE::flags, and FILE::ungetIndex.
Referenced by fputc(), fputs(), fwrite(), puts(), and vfprintf().
Definition at line 202 of file file.c.
References FILE::bufEnd, FILE::bufIndex, EINVAL, ERR, errno, FILE::fd, fpos_t::offset, FILE::pos, seek(), SEEK_CUR, SEEK_END, SEEK_SET, and FILE::ungetIndex.
Referenced by fseek().
| void _files_close | ( | void | ) |
Definition at line 278 of file file.c.
References fclose(), files, filesMtx, LIST_FOR_EACH_SAFE, mtx_lock(), and mtx_unlock().
Referenced by exit().
| uint64_t _files_flush | ( | void | ) |
Definition at line 292 of file file.c.
References EOF, ERR, fflush(), files, filesMtx, LIST_FOR_EACH, mtx_lock(), and mtx_unlock().
Referenced by fflush().
| void _files_init | ( | void | ) |
Definition at line 254 of file file.c.
References abort(), files, filesMtx, fprintf(), list_init(), mtx_init(), mtx_recursive, stderr, and thrd_success.
Referenced by _user_init().
| void _files_push | ( | FILE * | file | ) |
Definition at line 264 of file file.c.
References file, files, filesMtx, list_push(), mtx_lock(), and mtx_unlock().
Referenced by _std_stream_init(), and fopen().
| void _files_remove | ( | FILE * | file | ) |
Definition at line 271 of file file.c.
References file, files, filesMtx, list_remove(), mtx_lock(), and mtx_unlock().
Referenced by fclose().