27 |
|
|
28 |
# if USE_UNLOCKED_IO |
# if USE_UNLOCKED_IO |
29 |
|
|
30 |
/* These are wrappers for functions/macros from GNU libc. |
/* These are wrappers for functions/macros from the GNU C library, and |
31 |
|
from other C libraries supporting POSIX's optional thread-safe functions. |
32 |
|
|
33 |
The standard I/O functions are thread-safe. These *_unlocked ones are |
The standard I/O functions are thread-safe. These *_unlocked ones are |
34 |
more efficient but not thread-safe. That they're not thread-safe is |
more efficient but not thread-safe. That they're not thread-safe is |
35 |
fine since all of the applications in this package are single threaded. */ |
fine since all of the applications in this package are single threaded. |
36 |
|
|
37 |
|
Also, some code that is shared with the GNU C library may invoke |
38 |
|
the *_unlocked functions directly. On hosts that lack those |
39 |
|
functions, invoke the non-thread-safe versions instead. */ |
40 |
|
|
41 |
|
# include <stdio.h> |
42 |
|
|
43 |
# if HAVE_DECL_CLEARERR_UNLOCKED |
# if HAVE_DECL_CLEARERR_UNLOCKED |
44 |
# undef clearerr |
# undef clearerr |
45 |
# define clearerr(x) clearerr_unlocked (x) |
# define clearerr(x) clearerr_unlocked (x) |
46 |
|
# else |
47 |
|
# define clearerr_unlocked(x) clearerr (x) |
48 |
# endif |
# endif |
49 |
# if HAVE_DECL_FEOF_UNLOCKED |
# if HAVE_DECL_FEOF_UNLOCKED |
50 |
# undef feof |
# undef feof |
51 |
# define feof(x) feof_unlocked (x) |
# define feof(x) feof_unlocked (x) |
52 |
|
# else |
53 |
|
# define feof_unlocked(x) feof (x) |
54 |
# endif |
# endif |
55 |
# if HAVE_DECL_FERROR_UNLOCKED |
# if HAVE_DECL_FERROR_UNLOCKED |
56 |
# undef ferror |
# undef ferror |
57 |
# define ferror(x) ferror_unlocked (x) |
# define ferror(x) ferror_unlocked (x) |
58 |
|
# else |
59 |
|
# define ferror_unlocked(x) ferror (x) |
60 |
# endif |
# endif |
61 |
# if HAVE_DECL_FFLUSH_UNLOCKED |
# if HAVE_DECL_FFLUSH_UNLOCKED |
62 |
# undef fflush |
# undef fflush |
63 |
# define fflush(x) fflush_unlocked (x) |
# define fflush(x) fflush_unlocked (x) |
64 |
|
# else |
65 |
|
# define fflush_unlocked(x) fflush (x) |
66 |
# endif |
# endif |
67 |
# if HAVE_DECL_FGETS_UNLOCKED |
# if HAVE_DECL_FGETS_UNLOCKED |
68 |
# undef fgets |
# undef fgets |
69 |
# define fgets(x,y,z) fgets_unlocked (x,y,z) |
# define fgets(x,y,z) fgets_unlocked (x,y,z) |
70 |
|
# else |
71 |
|
# define fgets_unlocked(x,y,z) fgets (x,y,z) |
72 |
# endif |
# endif |
73 |
# if HAVE_DECL_FPUTC_UNLOCKED |
# if HAVE_DECL_FPUTC_UNLOCKED |
74 |
# undef fputc |
# undef fputc |
75 |
# define fputc(x,y) fputc_unlocked (x,y) |
# define fputc(x,y) fputc_unlocked (x,y) |
76 |
|
# else |
77 |
|
# define fputc_unlocked(x,y) fputc (x,y) |
78 |
# endif |
# endif |
79 |
# if HAVE_DECL_FPUTS_UNLOCKED |
# if HAVE_DECL_FPUTS_UNLOCKED |
80 |
# undef fputs |
# undef fputs |
81 |
# define fputs(x,y) fputs_unlocked (x,y) |
# define fputs(x,y) fputs_unlocked (x,y) |
82 |
|
# else |
83 |
|
# define fputs_unlocked(x,y) fputs (x,y) |
84 |
# endif |
# endif |
85 |
# if HAVE_DECL_FREAD_UNLOCKED |
# if HAVE_DECL_FREAD_UNLOCKED |
86 |
# undef fread |
# undef fread |
87 |
# define fread(w,x,y,z) fread_unlocked (w,x,y,z) |
# define fread(w,x,y,z) fread_unlocked (w,x,y,z) |
88 |
|
# else |
89 |
|
# define fread_unlocked(w,x,y,z) fread (w,x,y,z) |
90 |
# endif |
# endif |
91 |
# if HAVE_DECL_FWRITE_UNLOCKED |
# if HAVE_DECL_FWRITE_UNLOCKED |
92 |
# undef fwrite |
# undef fwrite |
93 |
# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) |
# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) |
94 |
|
# else |
95 |
|
# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) |
96 |
# endif |
# endif |
97 |
# if HAVE_DECL_GETC_UNLOCKED |
# if HAVE_DECL_GETC_UNLOCKED |
98 |
# undef getc |
# undef getc |
99 |
# define getc(x) getc_unlocked (x) |
# define getc(x) getc_unlocked (x) |
100 |
|
# else |
101 |
|
# define getc_unlocked(x) getc (x) |
102 |
# endif |
# endif |
103 |
# if HAVE_DECL_GETCHAR_UNLOCKED |
# if HAVE_DECL_GETCHAR_UNLOCKED |
104 |
# undef getchar |
# undef getchar |
105 |
# define getchar() getchar_unlocked () |
# define getchar() getchar_unlocked () |
106 |
|
# else |
107 |
|
# define getchar_unlocked() getchar () |
108 |
# endif |
# endif |
109 |
# if HAVE_DECL_PUTC_UNLOCKED |
# if HAVE_DECL_PUTC_UNLOCKED |
110 |
# undef putc |
# undef putc |
111 |
# define putc(x,y) putc_unlocked (x,y) |
# define putc(x,y) putc_unlocked (x,y) |
112 |
|
# else |
113 |
|
# define putc_unlocked(x,y) putc (x,y) |
114 |
# endif |
# endif |
115 |
# if HAVE_DECL_PUTCHAR_UNLOCKED |
# if HAVE_DECL_PUTCHAR_UNLOCKED |
116 |
# undef putchar |
# undef putchar |
117 |
# define putchar(x) putchar_unlocked (x) |
# define putchar(x) putchar_unlocked (x) |
118 |
|
# else |
119 |
|
# define putchar_unlocked(x) putchar (x) |
120 |
# endif |
# endif |
121 |
|
|
122 |
|
# undef flockfile |
123 |
|
# define flockfile(x) ((void) 0) |
124 |
|
|
125 |
|
# undef ftrylockfile |
126 |
|
# define ftrylockfile(x) 0 |
127 |
|
|
128 |
|
# undef funlockfile |
129 |
|
# define funlockfile(x) ((void) 0) |
130 |
|
|
131 |
# endif /* USE_UNLOCKED_IO */ |
# endif /* USE_UNLOCKED_IO */ |
132 |
#endif /* UNLOCKED_IO_H */ |
#endif /* UNLOCKED_IO_H */ |