14 |
|
|
15 |
You should have received a copy of the GNU General Public License along |
You should have received a copy of the GNU General Public License along |
16 |
with this program; if not, write to the Free Software Foundation, |
with this program; if not, write to the Free Software Foundation, |
17 |
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 |
|
|
19 |
/* Written by Jim Meyering. */ |
/* Written by Jim Meyering. */ |
20 |
|
|
21 |
#ifndef UNLOCKED_IO_H |
#ifndef UNLOCKED_IO_H |
22 |
#define UNLOCKED_IO_H 1 |
# define UNLOCKED_IO_H 1 |
23 |
|
|
24 |
/* These are wrappers for functions/macros from the GNU C library, and |
/* These are wrappers for functions/macros from the GNU C library, and |
25 |
from other C libraries supporting POSIX's optional thread-safe functions. |
from other C libraries supporting POSIX's optional thread-safe functions. |
32 |
the *_unlocked functions directly. On hosts that lack those |
the *_unlocked functions directly. On hosts that lack those |
33 |
functions, invoke the non-thread-safe versions instead. */ |
functions, invoke the non-thread-safe versions instead. */ |
34 |
|
|
35 |
#include <stdio.h> |
# include <stdio.h> |
36 |
|
|
37 |
#if HAVE_DECL_CLEARERR_UNLOCKED |
# if HAVE_DECL_CLEARERR_UNLOCKED |
38 |
# undef clearerr |
# undef clearerr |
39 |
# define clearerr(x) clearerr_unlocked (x) |
# define clearerr(x) clearerr_unlocked (x) |
40 |
#else |
# else |
41 |
# define clearerr_unlocked(x) clearerr (x) |
# define clearerr_unlocked(x) clearerr (x) |
42 |
#endif |
# endif |
43 |
|
|
44 |
#if HAVE_DECL_FEOF_UNLOCKED |
# if HAVE_DECL_FEOF_UNLOCKED |
45 |
# undef feof |
# undef feof |
46 |
# define feof(x) feof_unlocked (x) |
# define feof(x) feof_unlocked (x) |
47 |
#else |
# else |
48 |
# define feof_unlocked(x) feof (x) |
# define feof_unlocked(x) feof (x) |
49 |
#endif |
# endif |
50 |
|
|
51 |
#if HAVE_DECL_FERROR_UNLOCKED |
# if HAVE_DECL_FERROR_UNLOCKED |
52 |
# undef ferror |
# undef ferror |
53 |
# define ferror(x) ferror_unlocked (x) |
# define ferror(x) ferror_unlocked (x) |
54 |
#else |
# else |
55 |
# define ferror_unlocked(x) ferror (x) |
# define ferror_unlocked(x) ferror (x) |
56 |
#endif |
# endif |
57 |
|
|
58 |
#if HAVE_DECL_FFLUSH_UNLOCKED |
# if HAVE_DECL_FFLUSH_UNLOCKED |
59 |
# undef fflush |
# undef fflush |
60 |
# define fflush(x) fflush_unlocked (x) |
# define fflush(x) fflush_unlocked (x) |
61 |
#else |
# else |
62 |
# define fflush_unlocked(x) fflush (x) |
# define fflush_unlocked(x) fflush (x) |
63 |
#endif |
# endif |
64 |
|
|
65 |
#if HAVE_DECL_FGETS_UNLOCKED |
# if HAVE_DECL_FGETS_UNLOCKED |
66 |
# undef fgets |
# undef fgets |
67 |
# define fgets(x,y,z) fgets_unlocked (x,y,z) |
# define fgets(x,y,z) fgets_unlocked (x,y,z) |
68 |
#else |
# else |
69 |
# define fgets_unlocked(x,y,z) fgets (x,y,z) |
# define fgets_unlocked(x,y,z) fgets (x,y,z) |
70 |
#endif |
# endif |
71 |
|
|
72 |
#if HAVE_DECL_FPUTC_UNLOCKED |
# if HAVE_DECL_FPUTC_UNLOCKED |
73 |
# undef fputc |
# undef fputc |
74 |
# define fputc(x,y) fputc_unlocked (x,y) |
# define fputc(x,y) fputc_unlocked (x,y) |
75 |
#else |
# else |
76 |
# define fputc_unlocked(x,y) fputc (x,y) |
# define fputc_unlocked(x,y) fputc (x,y) |
77 |
#endif |
# endif |
78 |
|
|
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 |
# else |
83 |
# define fputs_unlocked(x,y) fputs (x,y) |
# define fputs_unlocked(x,y) fputs (x,y) |
84 |
#endif |
# endif |
85 |
|
|
86 |
#if HAVE_DECL_FREAD_UNLOCKED |
# if HAVE_DECL_FREAD_UNLOCKED |
87 |
# undef fread |
# undef fread |
88 |
# define fread(w,x,y,z) fread_unlocked (w,x,y,z) |
# define fread(w,x,y,z) fread_unlocked (w,x,y,z) |
89 |
#else |
# else |
90 |
# define fread_unlocked(w,x,y,z) fread (w,x,y,z) |
# define fread_unlocked(w,x,y,z) fread (w,x,y,z) |
91 |
#endif |
# endif |
92 |
|
|
93 |
#if HAVE_DECL_FWRITE_UNLOCKED |
# if HAVE_DECL_FWRITE_UNLOCKED |
94 |
# undef fwrite |
# undef fwrite |
95 |
# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) |
# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) |
96 |
#else |
# else |
97 |
# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) |
# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) |
98 |
#endif |
# endif |
99 |
|
|
100 |
#if HAVE_DECL_GETC_UNLOCKED |
# if HAVE_DECL_GETC_UNLOCKED |
101 |
# undef getc |
# undef getc |
102 |
# define getc(x) getc_unlocked (x) |
# define getc(x) getc_unlocked (x) |
103 |
#else |
# else |
104 |
# define getc_unlocked(x) getc (x) |
# define getc_unlocked(x) getc (x) |
105 |
#endif |
# endif |
106 |
|
|
107 |
#if HAVE_DECL_GETCHAR_UNLOCKED |
# if HAVE_DECL_GETCHAR_UNLOCKED |
108 |
# undef getchar |
# undef getchar |
109 |
# define getchar() getchar_unlocked () |
# define getchar() getchar_unlocked () |
110 |
#else |
# else |
111 |
# define getchar_unlocked() getchar () |
# define getchar_unlocked() getchar () |
112 |
#endif |
# endif |
113 |
|
|
114 |
#if HAVE_DECL_PUTC_UNLOCKED |
# if HAVE_DECL_PUTC_UNLOCKED |
115 |
# undef putc |
# undef putc |
116 |
# define putc(x,y) putc_unlocked (x,y) |
# define putc(x,y) putc_unlocked (x,y) |
117 |
#else |
# else |
118 |
# define putc_unlocked(x,y) putc (x,y) |
# define putc_unlocked(x,y) putc (x,y) |
119 |
#endif |
# endif |
120 |
|
|
121 |
#if HAVE_DECL_PUTCHAR_UNLOCKED |
# if HAVE_DECL_PUTCHAR_UNLOCKED |
122 |
# undef putchar |
# undef putchar |
123 |
# define putchar(x) putchar_unlocked (x) |
# define putchar(x) putchar_unlocked (x) |
124 |
#else |
# else |
125 |
# define putchar_unlocked(x) putchar (x) |
# define putchar_unlocked(x) putchar (x) |
126 |
#endif |
# endif |
127 |
|
|
128 |
#undef flockfile |
# undef flockfile |
129 |
#define flockfile(x) ((void) 0) |
# define flockfile(x) ((void) 0) |
130 |
|
|
131 |
#undef ftrylockfile |
# undef ftrylockfile |
132 |
#define ftrylockfile(x) 0 |
# define ftrylockfile(x) 0 |
133 |
|
|
134 |
#undef funlockfile |
# undef funlockfile |
135 |
#define funlockfile(x) ((void) 0) |
# define funlockfile(x) ((void) 0) |
136 |
|
|
137 |
#endif /* UNLOCKED_IO_H */ |
#endif /* UNLOCKED_IO_H */ |