9 #define FFINALLOCK(f) ((f)->lock>=0 ? __lockfile((f)) : 0)
10 #define FLOCK(f) int __need_unlock = ((f)->lock>=0 ? __lockfile((f)) : 0)
11 #define FUNLOCK(f) do { if (__need_unlock) __unlockfile((f)); } while (0)
23 unsigned char *rpos
, *rend
;
25 unsigned char *wend
, *wpos
;
26 unsigned char *mustbezero_1
;
28 size_t (*read
)(FILE *, unsigned char *, size_t);
29 size_t (*write
)(FILE *, const unsigned char *, size_t);
30 off_t (*seek
)(FILE *, off_t
, int);
46 FILE *prev_locked
, *next_locked
;
47 struct __locale_struct
*locale
;
50 extern hidden
FILE *volatile __stdin_used
;
51 extern hidden
FILE *volatile __stdout_used
;
52 extern hidden
FILE *volatile __stderr_used
;
54 hidden
int __lockfile(FILE *);
55 hidden
void __unlockfile(FILE *);
57 hidden
size_t __stdio_read(FILE *, unsigned char *, size_t);
58 hidden
size_t __stdio_write(FILE *, const unsigned char *, size_t);
59 hidden
size_t __stdout_write(FILE *, const unsigned char *, size_t);
60 hidden off_t
__stdio_seek(FILE *, off_t
, int);
61 hidden
int __stdio_close(FILE *);
63 hidden
int __toread(FILE *);
64 hidden
int __towrite(FILE *);
66 hidden
void __stdio_exit(void);
67 hidden
void __stdio_exit_needed(void);
69 #if defined(__PIC__) && (100*__GNUC__+__GNUC_MINOR__ >= 303)
70 __attribute__((visibility("protected")))
72 int __overflow(FILE *, int), __uflow(FILE *);
74 hidden
int __fseeko(FILE *, off_t
, int);
75 hidden
int __fseeko_unlocked(FILE *, off_t
, int);
76 hidden off_t
__ftello(FILE *);
77 hidden off_t
__ftello_unlocked(FILE *);
78 hidden
size_t __fwritex(const unsigned char *, size_t, FILE *);
79 hidden
int __putc_unlocked(int, FILE *);
81 hidden
FILE *__fdopen(int, const char *);
82 hidden
int __fmodeflags(const char *);
84 hidden
FILE *__ofl_add(FILE *f
);
85 hidden
FILE **__ofl_lock(void);
86 hidden
void __ofl_unlock(void);
89 hidden
void __register_locked_file(FILE *, struct __pthread
*);
90 hidden
void __unlist_locked_file(FILE *);
91 hidden
void __do_orphaned_stdio_locks(void);
93 #define MAYBE_WAITERS 0x40000000
95 hidden
void __getopt_msg(const char *, const char *, const char *, size_t);
97 #define feof(f) ((f)->flags & F_EOF)
98 #define ferror(f) ((f)->flags & F_ERR)
100 #define getc_unlocked(f) \
101 ( ((f)->rpos != (f)->rend) ? *(f)->rpos++ : __uflow((f)) )
103 #define putc_unlocked(c, f) \
104 ( (((unsigned char)(c)!=(f)->lbf && (f)->wpos!=(f)->wend)) \
105 ? *(f)->wpos++ = (unsigned char)(c) \
106 : __overflow((f),(unsigned char)(c)) )
108 /* Caller-allocated FILE * operations */
109 hidden
FILE *__fopen_rb_ca(const char *, FILE *, unsigned char *, size_t);
110 hidden
int __fclose_ca(FILE *);