fix more unused variable warnings
[musl] / src / internal / stdio_impl.h
1 #ifndef _STDIO_IMPL_H
2 #define _STDIO_IMPL_H
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <stddef.h>
7 #include <stdarg.h>
8 #include <string.h>
9 #include <inttypes.h>
10 #include <wchar.h>
11 #include <unistd.h>
12 #include <fcntl.h>
13 #include <limits.h>
14 #include <errno.h>
15 #include <termios.h>
16 #include <sys/ioctl.h>
17 #include <ctype.h>
18 #include <sys/wait.h>
19 #include <math.h>
20 #include <float.h>
21 #include <sys/uio.h>
22 #include "syscall.h"
23 #include "libc.h"
24
25 #define UNGET 8
26
27 #define FFINALLOCK(f) ((f)->lock>=0 ? __lockfile((f)) : 0)
28 #define FLOCK(f) int __need_unlock = ((f)->lock>=0 ? __lockfile((f)) : 0)
29 #define FUNLOCK(f) if (__need_unlock) __unlockfile((f)); else
30
31 #define F_PERM 1
32 #define F_NORD 4
33 #define F_NOWR 8
34 #define F_EOF 16
35 #define F_ERR 32
36 #define F_SVB 64
37
38 struct __FILE_s {
39         unsigned flags;
40         unsigned char *rpos, *rend;
41         int (*close)(FILE *);
42         unsigned char *wend, *wpos;
43         unsigned char *mustbezero_1;
44         unsigned char *wbase;
45         size_t (*read)(FILE *, unsigned char *, size_t);
46         size_t (*write)(FILE *, const unsigned char *, size_t);
47         off_t (*seek)(FILE *, off_t, int);
48         unsigned char *buf;
49         size_t buf_size;
50         FILE *prev, *next;
51         int fd;
52         int pipe_pid;
53         long lockcount;
54         short dummy3;
55         signed char mode;
56         signed char lbf;
57         int lock;
58         int waiters;
59         void *cookie;
60         off_t off;
61         char *getln_buf;
62         void *mustbezero_2;
63         unsigned char *shend;
64         off_t shlim, shcnt;
65 };
66
67 size_t __stdio_read(FILE *, unsigned char *, size_t);
68 size_t __stdio_write(FILE *, const unsigned char *, size_t);
69 size_t __stdout_write(FILE *, const unsigned char *, size_t);
70 off_t __stdio_seek(FILE *, off_t, int);
71 int __stdio_close(FILE *);
72
73 size_t __string_read(FILE *, unsigned char *, size_t);
74
75 int __toread(FILE *);
76 int __towrite(FILE *);
77
78 #if defined(__PIC__) && (100*__GNUC__+__GNUC_MINOR__ >= 303)
79 __attribute__((visibility("protected")))
80 #endif
81 int __overflow(FILE *, int), __uflow(FILE *);
82
83 int __fseeko(FILE *, off_t, int);
84 int __fseeko_unlocked(FILE *, off_t, int);
85 off_t __ftello(FILE *);
86 off_t __ftello_unlocked(FILE *);
87 size_t __fwritex(const unsigned char *, size_t, FILE *);
88 int __putc_unlocked(int, FILE *);
89
90 FILE *__fdopen(int, const char *);
91 int __fmodeflags(const char *);
92
93 #define OFLLOCK() LOCK(libc.ofl_lock)
94 #define OFLUNLOCK() UNLOCK(libc.ofl_lock)
95
96 #define feof(f) ((f)->flags & F_EOF)
97 #define ferror(f) ((f)->flags & F_ERR)
98
99 #define getc_unlocked(f) \
100         ( ((f)->rpos < (f)->rend) ? *(f)->rpos++ : __uflow((f)) )
101
102 #define putc_unlocked(c, f) ( ((c)!=(f)->lbf && (f)->wpos<(f)->wend) \
103         ? *(f)->wpos++ = (c) : __overflow((f),(c)) )
104
105 /* Caller-allocated FILE * operations */
106 FILE *__fopen_rb_ca(const char *, FILE *, unsigned char *, size_t);
107 int __fclose_ca(FILE *);
108
109 #endif