1 
2 #ifndef __STDIO_H__
3 #define __STDIO_H__
4 
5 #include <sys/types.h>
6 #include <sys/cdefs.h>
7 
8 typedef struct FILE {
9     int			in_use;
10     uint64_t		fd;		/* Kernel File Descriptor */
11     fpos_t		offset;
12 } FILE;
13 
14 #define SEEK_SET	0
15 #define SEEK_CUR	1
16 #define SEEK_END	2
17 
18 #define EOF		(-1)
19 
20 extern FILE *stdin;
21 extern FILE *stdout;
22 extern FILE *stderr;
23 
24 #define FOPEN_MAX	16
25 
26 FILE *fopen(const char *path, const char *mode);
27 int fclose(FILE *fh);
28 int feof(FILE *fh);
29 int fflush(FILE *fh);
30 size_t fread(void *buf, size_t size, size_t nmemb, FILE *fh);
31 size_t fwrite(const void *buf, size_t size, size_t nmemb, FILE *fh);
32 
33 int fputc(int ch, FILE *fh);
34 int fputs(const char *str, FILE *fh);
35 int fgetc(FILE *fh);
36 char *fgets(char *str, int size, FILE *fh);
37 
38 int puts(const char *str);
39 #define getc(_fh) fgetc(_fh)
40 
41 int printf(const char *fmt, ...);
42 int fprintf(FILE *stream, const char *fmt, ...);
43 int sprintf(char *str, const char *fmt, ...);
44 int snprintf(char *str, size_t size, const char *fmt, ...) __printflike(3, 4);;
45 
46 #endif /* __STDIO_H__ */
47 
48