apply hidden visibility to sigreturn code fragments
[musl.git] / src / internal / stdio_impl.h
blob028b7975ce440269e2866495d591b0d368c4d37b
1 #ifndef _STDIO_IMPL_H
2 #define _STDIO_IMPL_H
4 #include <stdio.h>
5 #include "syscall.h"
6 #include "libc.h"
8 #define UNGET 8
10 #define FFINALLOCK(f) ((f)->lock>=0 ? __lockfile((f)) : 0)
11 #define FLOCK(f) int __need_unlock = ((f)->lock>=0 ? __lockfile((f)) : 0)
12 #define FUNLOCK(f) do { if (__need_unlock) __unlockfile((f)); } while (0)
14 #define F_PERM 1
15 #define F_NORD 4
16 #define F_NOWR 8
17 #define F_EOF 16
18 #define F_ERR 32
19 #define F_SVB 64
20 #define F_APP 128
22 struct _IO_FILE {
23 unsigned flags;
24 unsigned char *rpos, *rend;
25 int (*close)(FILE *);
26 unsigned char *wend, *wpos;
27 unsigned char *mustbezero_1;
28 unsigned char *wbase;
29 size_t (*read)(FILE *, unsigned char *, size_t);
30 size_t (*write)(FILE *, const unsigned char *, size_t);
31 off_t (*seek)(FILE *, off_t, int);
32 unsigned char *buf;
33 size_t buf_size;
34 FILE *prev, *next;
35 int fd;
36 int pipe_pid;
37 long lockcount;
38 short dummy3;
39 signed char mode;
40 signed char lbf;
41 volatile int lock;
42 volatile int waiters;
43 void *cookie;
44 off_t off;
45 char *getln_buf;
46 void *mustbezero_2;
47 unsigned char *shend;
48 off_t shlim, shcnt;
49 FILE *prev_locked, *next_locked;
50 struct __locale_struct *locale;
53 hidden size_t __stdio_read(FILE *, unsigned char *, size_t);
54 hidden size_t __stdio_write(FILE *, const unsigned char *, size_t);
55 hidden size_t __stdout_write(FILE *, const unsigned char *, size_t);
56 hidden off_t __stdio_seek(FILE *, off_t, int);
57 hidden int __stdio_close(FILE *);
59 hidden size_t __string_read(FILE *, unsigned char *, size_t);
61 hidden int __toread(FILE *);
62 hidden int __towrite(FILE *);
64 hidden void __stdio_exit_needed(void);
66 #if defined(__PIC__) && (100*__GNUC__+__GNUC_MINOR__ >= 303)
67 __attribute__((visibility("protected")))
68 #endif
69 int __overflow(FILE *, int), __uflow(FILE *);
71 hidden int __fseeko(FILE *, off_t, int);
72 hidden int __fseeko_unlocked(FILE *, off_t, int);
73 hidden off_t __ftello(FILE *);
74 hidden off_t __ftello_unlocked(FILE *);
75 hidden size_t __fwritex(const unsigned char *, size_t, FILE *);
76 hidden int __putc_unlocked(int, FILE *);
78 hidden FILE *__fdopen(int, const char *);
79 hidden int __fmodeflags(const char *);
81 hidden FILE *__ofl_add(FILE *f);
82 hidden FILE **__ofl_lock(void);
83 hidden void __ofl_unlock(void);
85 struct __pthread;
86 hidden void __register_locked_file(FILE *, struct __pthread *);
87 hidden void __unlist_locked_file(FILE *);
88 hidden void __do_orphaned_stdio_locks(void);
90 hidden void __getopt_msg(const char *, const char *, const char *, size_t);
92 #define feof(f) ((f)->flags & F_EOF)
93 #define ferror(f) ((f)->flags & F_ERR)
95 #define getc_unlocked(f) \
96 ( ((f)->rpos < (f)->rend) ? *(f)->rpos++ : __uflow((f)) )
98 #define putc_unlocked(c, f) \
99 ( ((unsigned char)(c)!=(f)->lbf && (f)->wpos<(f)->wend) \
100 ? *(f)->wpos++ = (c) : __overflow((f),(c)) )
102 /* Caller-allocated FILE * operations */
103 hidden FILE *__fopen_rb_ca(const char *, FILE *, unsigned char *, size_t);
104 hidden int __fclose_ca(FILE *);
106 #endif