uClibc_stdio.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. /* Copyright (C) 2002-2004 Manuel Novoa III <mjn3@codepoet.org>
  2. *
  3. * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * The GNU C Library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with the GNU C Library; if not, write to the Free
  17. * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  18. * 02111-1307 USA.
  19. */
  20. #ifndef _STDIO_H
  21. #error Always include <stdio.h> rather than <bits/uClibc_stdio.h>
  22. #endif
  23. /**********************************************************************/
  24. #define __STDIO_BUFFERS
  25. /* ANSI/ISO mandate at least 256. */
  26. #if defined(__UCLIBC_HAS_STDIO_BUFSIZ_NONE__)
  27. /* Fake this because some apps use stdio.h BUFSIZ. */
  28. #define __STDIO_BUFSIZ 256
  29. #undef __STDIO_BUFFERS
  30. #elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_256__)
  31. #define __STDIO_BUFSIZ 256
  32. #elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_512__)
  33. #define __STDIO_BUFSIZ 512
  34. #elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_1024__)
  35. #define __STDIO_BUFSIZ 1024
  36. #elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_2048__)
  37. #define __STDIO_BUFSIZ 2048
  38. #elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_4096__)
  39. #define __STDIO_BUFSIZ 4096
  40. #elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_8192__)
  41. #define __STDIO_BUFSIZ 8192
  42. #else
  43. #error config seems to be out of sync regarding bufsiz options
  44. #endif
  45. #ifdef __UCLIBC_HAS_STDIO_BUFSIZ_NONE__
  46. #define __STDIO_BUILTIN_BUF_SIZE 0
  47. #else /* __UCLIBC_HAS_STDIO_BUFSIZ_NONE__ */
  48. #if defined(__UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE__)
  49. #define __STDIO_BUILTIN_BUF_SIZE 0
  50. #elif defined(__UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4__)
  51. #define __STDIO_BUILTIN_BUF_SIZE 4
  52. #elif defined(__UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8__)
  53. #define __STDIO_BUILTIN_BUF_SIZE 8
  54. #else
  55. #error config seems to be out of sync regarding builtin buffer size
  56. #endif
  57. #endif
  58. #if defined(__STDIO_BUFFERS) || defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__) || defined(__UCLIBC_HAS_THREADS__)
  59. #define __STDIO_HAS_OPENLIST 1
  60. #else
  61. #undef __STDIO_HAS_OPENLIST
  62. #endif
  63. /**********************************************************************/
  64. /* Make sure defines related to large files are consistent. */
  65. #if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc)
  66. #ifdef __UCLIBC_HAS_LFS__
  67. #undef __USE_LARGEFILE
  68. #undef __USE_LARGEFILE64
  69. #undef __USE_FILE_OFFSET64
  70. /* If we're actually building uClibc with large file support, only define... */
  71. #define __USE_LARGEFILE64 1
  72. #endif /* __UCLIBC_HAS_LFS__ */
  73. #else /* not _LIBC */
  74. #ifndef __UCLIBC_HAS_LFS__
  75. #if defined(__LARGEFILE64_SOURCE) || defined(__USE_LARGEFILE64) || defined(__USE_FILE_OFFSET64)
  76. #error Sorry... uClibc was built without large file support!
  77. #endif
  78. #endif /* __UCLIBC_HAS_LFS__ */
  79. #endif /* _LIBC */
  80. /**********************************************************************/
  81. #ifdef __UCLIBC_HAS_WCHAR__
  82. #define __need_wchar_t
  83. #include <stddef.h>
  84. /* Note: we don't really need mbstate for 8-bit locales. We do for UTF-8.
  85. * For now, always use it. */
  86. #define __STDIO_MBSTATE
  87. #define __need_mbstate_t
  88. #include <wchar.h>
  89. #endif
  90. /**********************************************************************/
  91. /* Currently unimplemented/untested */
  92. /* #define __STDIO_FLEXIBLE_SETVBUF */
  93. #ifdef __UCLIBC_HAS_STDIO_GETC_MACRO__
  94. #define __STDIO_GETC_MACRO
  95. #endif
  96. #ifdef __UCLIBC_HAS_STDIO_PUTC_MACRO__
  97. #define __STDIO_PUTC_MACRO
  98. #endif
  99. /* These are consistency checks on the different options */
  100. #ifndef __STDIO_BUFFERS
  101. #undef __STDIO_GETC_MACRO
  102. #undef __STDIO_PUTC_MACRO
  103. #endif
  104. #ifdef __BCC__
  105. #undef __UCLIBC_HAS_LFS__
  106. #endif
  107. #ifndef __UCLIBC_HAS_LFS__
  108. #undef __UCLIBC_HAS_FOPEN_LARGEFILE_MODE__
  109. #endif
  110. /**********************************************************************/
  111. #ifdef __UCLIBC_HAS_THREADS__
  112. /* Need this for pthread_mutex_t. */
  113. #include <bits/pthreadtypes.h>
  114. /* user_locking
  115. * 0 : do auto locking/unlocking
  116. * 1 : user does locking/unlocking
  117. * 2 : initial state prior to thread initialization
  118. * with no auto locking/unlocking
  119. *
  120. * When threading is initialized, walk the stdio open stream list
  121. * and do "if (user_locking == 2) user_locking = 0;".
  122. *
  123. * This way, we avoid calling the weak lock/unlock functions.
  124. */
  125. #define __STDIO_AUTO_THREADLOCK_VAR int __infunc_user_locking
  126. #define __STDIO_AUTO_THREADLOCK(__stream) \
  127. if ((__infunc_user_locking = (__stream)->__user_locking) == 0) { \
  128. __pthread_mutex_lock(&(__stream)->__lock); \
  129. }
  130. #define __STDIO_AUTO_THREADUNLOCK(__stream) \
  131. if (__infunc_user_locking == 0) { \
  132. __pthread_mutex_unlock(&(__stream)->__lock); \
  133. }
  134. #define __STDIO_SET_USER_LOCKING(__stream) ((__stream)->__user_locking = 1)
  135. #define __STDIO_ALWAYS_THREADLOCK(__stream) \
  136. __pthread_mutex_lock(&(__stream)->__lock)
  137. #define __STDIO_ALWAYS_THREADTRYLOCK(__stream) \
  138. __pthread_mutex_trylock(&(__stream)->__lock)
  139. #define __STDIO_ALWAYS_THREADUNLOCK(__stream) \
  140. __pthread_mutex_unlock(&(__stream)->__lock)
  141. #else /* __UCLIBC_HAS_THREADS__ */
  142. #define __STDIO_AUTO_THREADLOCK_VAR ((void)0)
  143. #define __STDIO_AUTO_THREADLOCK(__stream) ((void)0)
  144. #define __STDIO_AUTO_THREADUNLOCK(__stream) ((void)0)
  145. #define __STDIO_SET_USER_LOCKING(__stream) ((void)0)
  146. #define __STDIO_ALWAYS_THREADLOCK(__stream) ((void)0)
  147. #define __STDIO_ALWAYS_THREADTRYLOCK(__stream) (0) /* Always succeed. */
  148. #define __STDIO_ALWAYS_THREADUNLOCK(__stream) ((void)0)
  149. #endif /* __UCLIBC_HAS_THREADS__ */
  150. /**********************************************************************/
  151. #define __STDIO_IOFBF 0 /* Fully buffered. */
  152. #define __STDIO_IOLBF 1 /* Line buffered. */
  153. #define __STDIO_IONBF 2 /* No buffering. */
  154. typedef struct {
  155. __off_t __pos;
  156. #ifdef __STDIO_MBSTATE
  157. __mbstate_t __mbstate;
  158. #endif
  159. #ifdef __UCLIBC_HAS_WCHAR__
  160. int __mblen_pending;
  161. #endif
  162. } __STDIO_fpos_t;
  163. #ifdef __UCLIBC_HAS_LFS__
  164. typedef struct {
  165. __off64_t __pos;
  166. #ifdef __STDIO_MBSTATE
  167. __mbstate_t __mbstate;
  168. #endif
  169. #ifdef __UCLIBC_HAS_WCHAR__
  170. int __mblen_pending;
  171. #endif
  172. } __STDIO_fpos64_t;
  173. #endif
  174. /**********************************************************************/
  175. #ifdef __UCLIBC_HAS_LFS__
  176. typedef __off64_t __offmax_t; /* TODO -- rename this? */
  177. #else
  178. typedef __off_t __offmax_t; /* TODO -- rename this? */
  179. #endif
  180. /**********************************************************************/
  181. #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
  182. typedef __ssize_t __io_read_fn(void *__cookie, char *__buf, size_t __bufsize);
  183. typedef __ssize_t __io_write_fn(void *__cookie,
  184. __const char *__buf, size_t __bufsize);
  185. /* NOTE: GLIBC difference!!! -- fopencookie seek function
  186. * For glibc, the type of pos is always (__off64_t *) but in our case
  187. * it is type (__off_t *) when the lib is built without large file support.
  188. */
  189. typedef int __io_seek_fn(void *__cookie, __offmax_t *__pos, int __whence);
  190. typedef int __io_close_fn(void *__cookie);
  191. typedef struct {
  192. __io_read_fn *read;
  193. __io_write_fn *write;
  194. __io_seek_fn *seek;
  195. __io_close_fn *close;
  196. } _IO_cookie_io_functions_t;
  197. #ifdef __USE_GNU
  198. typedef __io_read_fn cookie_read_function_t;
  199. typedef __io_write_fn cookie_write_function_t;
  200. typedef __io_seek_fn cookie_seek_function_t;
  201. typedef __io_close_fn cookie_close_function_t;
  202. typedef _IO_cookie_io_functions_t cookie_io_functions_t;
  203. #endif
  204. #endif
  205. /**********************************************************************/
  206. struct __STDIO_FILE_STRUCT {
  207. unsigned short __modeflags;
  208. /* There could be a hole here, but modeflags is used most.*/
  209. #ifdef __UCLIBC_HAS_WCHAR__
  210. unsigned char __ungot_width[2]; /* 0: current (building) char; 1: scanf */
  211. /* Move the following futher down to avoid problems with getc/putc
  212. * macros breaking shared apps when wchar config support is changed. */
  213. /* wchar_t ungot[2]; */
  214. #else /* __UCLIBC_HAS_WCHAR__ */
  215. unsigned char __ungot[2];
  216. #endif /* __UCLIBC_HAS_WCHAR__ */
  217. int __filedes;
  218. #ifdef __STDIO_BUFFERS
  219. unsigned char *__bufstart; /* pointer to buffer */
  220. unsigned char *__bufend; /* pointer to 1 past end of buffer */
  221. unsigned char *__bufpos;
  222. unsigned char *__bufread; /* pointer to 1 past last buffered read char */
  223. #ifdef __STDIO_GETC_MACRO
  224. unsigned char *__bufgetc_u; /* 1 past last readable by getc_unlocked */
  225. #endif /* __STDIO_GETC_MACRO */
  226. #ifdef __STDIO_PUTC_MACRO
  227. unsigned char *__bufputc_u; /* 1 past last writeable by putc_unlocked */
  228. #endif /* __STDIO_PUTC_MACRO */
  229. #endif /* __STDIO_BUFFERS */
  230. #ifdef __STDIO_HAS_OPENLIST
  231. struct __STDIO_FILE_STRUCT *__nextopen;
  232. #endif
  233. #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
  234. void *__cookie;
  235. _IO_cookie_io_functions_t __gcs;
  236. #endif
  237. #ifdef __UCLIBC_HAS_WCHAR__
  238. wchar_t __ungot[2];
  239. #endif
  240. #ifdef __STDIO_MBSTATE
  241. __mbstate_t __state;
  242. #endif
  243. #ifdef __UCLIBC_HAS_XLOCALE__
  244. void *__unused; /* Placeholder for codeset binding. */
  245. #endif
  246. #ifdef __UCLIBC_HAS_THREADS__
  247. int __user_locking;
  248. pthread_mutex_t __lock;
  249. #endif
  250. /* Everything after this is unimplemented... and may be trashed. */
  251. #if __STDIO_BUILTIN_BUF_SIZE > 0
  252. unsigned char __builtinbuf[__STDIO_BUILTIN_BUF_SIZE];
  253. #endif /* __STDIO_BUILTIN_BUF_SIZE > 0 */
  254. };
  255. /***********************************************************************/
  256. /* Having ungotten characters implies the stream is reading.
  257. * The scheme used here treats the least significant 2 bits of
  258. * the stream's modeflags member as follows:
  259. * 0 0 Not currently reading.
  260. * 0 1 Reading, but no ungetc() or scanf() push back chars.
  261. * 1 0 Reading with one ungetc() char (ungot[1] is 1)
  262. * or one scanf() pushed back char (ungot[1] is 0).
  263. * 1 1 Reading with both an ungetc() char and a scanf()
  264. * pushed back char. Note that this must be the result
  265. * of a scanf() push back (in ungot[0]) _followed_ by
  266. * an ungetc() call (in ungot[1]).
  267. *
  268. * Notes:
  269. * scanf() can NOT use ungetc() to push back characters.
  270. * (See section 7.19.6.2 of the C9X rationale -- WG14/N897.)
  271. */
  272. #define __MASK_READING 0x0003U /* (0x0001 | 0x0002) */
  273. #define __FLAG_READING 0x0001U
  274. #define __FLAG_UNGOT 0x0002U
  275. #define __FLAG_EOF 0x0004U
  276. #define __FLAG_ERROR 0x0008U
  277. #define __FLAG_WRITEONLY 0x0010U
  278. #define __FLAG_READONLY 0x0020U /* (__FLAG_WRITEONLY << 1) */
  279. #define __FLAG_WRITING 0x0040U
  280. #define __FLAG_NARROW 0x0080U
  281. #define __FLAG_FBF 0x0000U /* must be 0 */
  282. #define __FLAG_LBF 0x0100U
  283. #define __FLAG_NBF 0x0200U /* (__FLAG_LBF << 1) */
  284. #define __MASK_BUFMODE 0x0300U /* (__FLAG_LBF|__FLAG_NBF) */
  285. #define __FLAG_APPEND 0x0400U /* fixed! == O_APPEND for linux */
  286. #define __FLAG_WIDE 0x0800U
  287. /* available slot 0x1000U */
  288. #define __FLAG_FREEFILE 0x2000U
  289. #define __FLAG_FREEBUF 0x4000U
  290. #define __FLAG_LARGEFILE 0x8000U /* fixed! == 0_LARGEFILE for linux */
  291. /* Note: In no-buffer mode, it would be possible to pack the necessary
  292. * flags into one byte. Since we wouldn't be buffering and there would
  293. * be no support for wchar, the only flags we would need would be:
  294. * 2 bits : ungot count
  295. * 2 bits : eof + error
  296. * 2 bits : readonly + writeonly
  297. * 1 bit : freefile
  298. * 1 bit : appending
  299. * So, for a very small system (< 128 files) we might have a
  300. * 4-byte FILE struct of:
  301. * unsigned char flags;
  302. * signed char filedes;
  303. * unsigned char ungot[2];
  304. */
  305. /**********************************************************************
  306. * PROTOTYPES OF INTERNAL FUNCTIONS
  307. **********************************************************************/
  308. #if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc)
  309. extern void _stdio_init(void) attribute_hidden;
  310. extern void _stdio_term(void) attribute_hidden;
  311. #ifdef __STDIO_HAS_OPENLIST
  312. extern struct __STDIO_FILE_STRUCT *_stdio_openlist;
  313. #ifdef __UCLIBC_HAS_THREADS__
  314. extern pthread_mutex_t _stdio_openlist_lock;
  315. extern int _stdio_openlist_delflag;
  316. extern int _stdio_user_locking;
  317. /* #ifdef _LIBC */
  318. extern void __stdio_init_mutex(pthread_mutex_t *m) attribute_hidden;
  319. /* #endif */
  320. #endif
  321. #endif
  322. #endif
  323. /**********************************************************************/
  324. #define __CLEARERR_UNLOCKED(__stream) \
  325. ((void)((__stream)->__modeflags &= ~(__FLAG_EOF|__FLAG_ERROR)))
  326. #define __FEOF_UNLOCKED(__stream) ((__stream)->__modeflags & __FLAG_EOF)
  327. #define __FERROR_UNLOCKED(__stream) ((__stream)->__modeflags & __FLAG_ERROR)
  328. #ifdef __UCLIBC_HAS_THREADS__
  329. # define __CLEARERR(__stream) (clearerr)(__stream)
  330. # define __FERROR(__stream) (ferror)(__stream)
  331. # define __FEOF(__stream) (feof)(__stream)
  332. #else
  333. # define __CLEARERR(__stream) __CLEARERR_UNLOCKED(__stream)
  334. # define __FERROR(__stream) __FERROR_UNLOCKED(__stream)
  335. # define __FEOF(__stream) __FEOF_UNLOCKED(__stream)
  336. #endif
  337. extern int __fgetc_unlocked(FILE *__stream);
  338. extern int __fputc_unlocked(int __c, FILE *__stream);
  339. /* First define the default definitions. They will be overwritten below as necessary. */
  340. #define __FGETC_UNLOCKED(__stream) (__fgetc_unlocked)((__stream))
  341. #define __FGETC(__stream) (fgetc)((__stream))
  342. #define __GETC_UNLOCKED_MACRO(__stream) (__fgetc_unlocked)((__stream))
  343. #define __GETC_UNLOCKED(__stream) (__fgetc_unlocked)((__stream))
  344. #define __GETC(__stream) (fgetc)((__stream))
  345. #define __FPUTC_UNLOCKED(__c, __stream) (__fputc_unlocked)((__c),(__stream))
  346. #define __FPUTC(__c, __stream) (fputc)((__c),(__stream))
  347. #define __PUTC_UNLOCKED_MACRO(__c, __stream) (__fputc_unlocked)((__c),(__stream))
  348. #define __PUTC_UNLOCKED(__c, __stream) (__fputc_unlocked)((__c),(__stream))
  349. #define __PUTC(__c, __stream) (fputc)((__c),(__stream))
  350. #ifdef __STDIO_GETC_MACRO
  351. extern FILE *__stdin; /* For getchar() macro. */
  352. # undef __GETC_UNLOCKED_MACRO
  353. # define __GETC_UNLOCKED_MACRO(__stream) \
  354. ( ((__stream)->__bufpos < (__stream)->__bufgetc_u) \
  355. ? (*(__stream)->__bufpos++) \
  356. : __fgetc_unlocked(__stream) )
  357. # if 0
  358. /* Classic macro approach. getc{_unlocked} can have side effects. */
  359. # undef __GETC_UNLOCKED
  360. # define __GETC_UNLOCKED(__stream) __GETC_UNLOCKED_MACRO((__stream))
  361. # ifndef __UCLIBC_HAS_THREADS__
  362. # undef __GETC
  363. # define __GETC(__stream) __GETC_UNLOCKED_MACRO((__stream))
  364. # endif
  365. # else
  366. /* Using gcc extension for safety and additional inlining. */
  367. # undef __FGETC_UNLOCKED
  368. # define __FGETC_UNLOCKED(__stream) \
  369. (__extension__ ({ \
  370. FILE *__S = (__stream); \
  371. __GETC_UNLOCKED_MACRO(__S); \
  372. }) )
  373. # undef __GETC_UNLOCKED
  374. # define __GETC_UNLOCKED(__stream) __FGETC_UNLOCKED((__stream))
  375. # ifdef __UCLIBC_HAS_THREADS__
  376. # undef __FGETC
  377. # define __FGETC(__stream) \
  378. (__extension__ ({ \
  379. FILE *__S = (__stream); \
  380. ((__S->__user_locking ) \
  381. ? __GETC_UNLOCKED_MACRO(__S) \
  382. : (fgetc)(__S)); \
  383. }) )
  384. # undef __GETC
  385. # define __GETC(__stream) __FGETC((__stream))
  386. # else
  387. # undef __FGETC
  388. # define __FGETC(__stream) __FGETC_UNLOCKED((__stream))
  389. # undef __GETC
  390. # define __GETC(__stream) __FGETC_UNLOCKED((__stream))
  391. # endif
  392. # endif
  393. #else
  394. #endif /* __STDIO_GETC_MACRO */
  395. #ifdef __STDIO_PUTC_MACRO
  396. extern FILE *__stdout; /* For putchar() macro. */
  397. # undef __PUTC_UNLOCKED_MACRO
  398. # define __PUTC_UNLOCKED_MACRO(__c, __stream) \
  399. ( ((__stream)->__bufpos < (__stream)->__bufputc_u) \
  400. ? (*(__stream)->__bufpos++) = (__c) \
  401. : __fputc_unlocked((__c),(__stream)) )
  402. # if 0
  403. /* Classic macro approach. putc{_unlocked} can have side effects.*/
  404. # undef __PUTC_UNLOCKED
  405. # define __PUTC_UNLOCKED(__c, __stream) \
  406. __PUTC_UNLOCKED_MACRO((__c), (__stream))
  407. # ifndef __UCLIBC_HAS_THREADS__
  408. # undef __PUTC
  409. # define __PUTC(__c, __stream) __PUTC_UNLOCKED_MACRO((__c), (__stream))
  410. # endif
  411. # else
  412. /* Using gcc extension for safety and additional inlining. */
  413. # undef __FPUTC_UNLOCKED
  414. # define __FPUTC_UNLOCKED(__c, __stream) \
  415. (__extension__ ({ \
  416. FILE *__S = (__stream); \
  417. __PUTC_UNLOCKED_MACRO((__c),__S); \
  418. }) )
  419. # undef __PUTC_UNLOCKED
  420. # define __PUTC_UNLOCKED(__c, __stream) __FPUTC_UNLOCKED((__c), (__stream))
  421. # ifdef __UCLIBC_HAS_THREADS__
  422. # undef __FPUTC
  423. # define __FPUTC(__c, __stream) \
  424. (__extension__ ({ \
  425. FILE *__S = (__stream); \
  426. ((__S->__user_locking) \
  427. ? __PUTC_UNLOCKED_MACRO((__c),__S) \
  428. : (fputc)((__c),__S)); \
  429. }) )
  430. # undef __PUTC
  431. # define __PUTC(__c, __stream) __FPUTC((__c), (__stream))
  432. # else
  433. # undef __FPUTC
  434. # define __FPUTC(__c, __stream) __FPUTC_UNLOCKED((__c),(__stream))
  435. # undef __PUTC
  436. # define __PUTC(__c, __stream) __FPUTC_UNLOCKED((__c),(__stream))
  437. # endif
  438. # endif
  439. #endif /* __STDIO_PUTC_MACRO */