37,17 → 37,21 |
|
#include <sys/types.h> |
#include <stdarg.h> |
#include <string.h> |
#include <adt/list.h> |
|
#define EOF (-1) |
|
/** Default size for stream I/O buffers */ |
#define BUFSIZ 4096 |
|
#define DEBUG(fmt, ...) \ |
{ \ |
char buf[256]; \ |
int n = snprintf(buf, sizeof(buf), fmt, ##__VA_ARGS__); \ |
if (n > 0) \ |
(void) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, str_size(buf)); \ |
} |
{ \ |
char _buf[256]; \ |
int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \ |
if (_n > 0) \ |
(void) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) _buf, str_size(_buf)); \ |
} |
|
#ifndef SEEK_SET |
#define SEEK_SET 0 |
55,6 → 59,15 |
#define SEEK_END 2 |
#endif |
|
enum _buffer_type { |
/** No buffering */ |
_IONBF, |
/** Line buffering */ |
_IOLBF, |
/** Full buffering */ |
_IOFBF |
}; |
|
typedef struct { |
/** Linked list pointer. */ |
link_t link; |
73,6 → 86,15 |
|
/** Phone to the file provider */ |
int phone; |
|
/** Buffering type */ |
enum _buffer_type btype; |
/** Buffer */ |
uint8_t *buf; |
/** Buffer size */ |
size_t buf_size; |
/** Buffer I/O pointer */ |
uint8_t *buf_head; |
} FILE; |
|
extern FILE *stdin; |
121,6 → 143,8 |
extern int ferror(FILE *); |
extern void clearerr(FILE *); |
|
extern void setvbuf(FILE *, void *, int, size_t); |
|
/* Misc file functions */ |
extern int rename(const char *, const char *); |
|