stdio.h revision 104585
11539Srgrimes/*- 21539Srgrimes * Copyright (c) 1990, 1993 31539Srgrimes * The Regents of the University of California. All rights reserved. 41539Srgrimes * 51539Srgrimes * This code is derived from software contributed to Berkeley by 61539Srgrimes * Chris Torek. 71539Srgrimes * 81539Srgrimes * Redistribution and use in source and binary forms, with or without 91539Srgrimes * modification, are permitted provided that the following conditions 101539Srgrimes * are met: 111539Srgrimes * 1. Redistributions of source code must retain the above copyright 121539Srgrimes * notice, this list of conditions and the following disclaimer. 131539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141539Srgrimes * notice, this list of conditions and the following disclaimer in the 151539Srgrimes * documentation and/or other materials provided with the distribution. 161539Srgrimes * 3. All advertising materials mentioning features or use of this software 171539Srgrimes * must display the following acknowledgement: 181539Srgrimes * This product includes software developed by the University of 191539Srgrimes * California, Berkeley and its contributors. 201539Srgrimes * 4. Neither the name of the University nor the names of its contributors 211539Srgrimes * may be used to endorse or promote products derived from this software 221539Srgrimes * without specific prior written permission. 231539Srgrimes * 241539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341539Srgrimes * SUCH DAMAGE. 351539Srgrimes * 3623655Speter * @(#)stdio.h 8.5 (Berkeley) 4/29/95 3750473Speter * $FreeBSD: head/include/stdio.h 104585 2002-10-06 22:16:12Z mike $ 381539Srgrimes */ 391539Srgrimes 401539Srgrimes#ifndef _STDIO_H_ 411539Srgrimes#define _STDIO_H_ 421539Srgrimes 431539Srgrimes#include <sys/cdefs.h> 44102227Smike#include <sys/_types.h> 451539Srgrimes 46104585Smiketypedef __off_t fpos_t; 47104585Smike 48102227Smike#ifndef _SIZE_T_DECLARED 49102227Smiketypedef __size_t size_t; 50102227Smike#define _SIZE_T_DECLARED 511539Srgrimes#endif 521539Srgrimes 53104585Smike#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE 54104585Smike#ifndef _VA_LIST_DECLARED 55104585Smiketypedef __va_list va_list; 56104585Smike#define _VA_LIST_DECLARED 57104585Smike#endif 58104585Smike#endif 59104585Smike 601539Srgrimes#ifndef NULL 611539Srgrimes#define NULL 0 621539Srgrimes#endif 631539Srgrimes 641539Srgrimes#define _FSTDIO /* Define for new stdio with functions. */ 651539Srgrimes 661539Srgrimes/* 671539Srgrimes * NB: to fit things in six character monocase externals, the stdio 681539Srgrimes * code uses the prefix `__s' for stdio objects, typically followed 691539Srgrimes * by a three-character attempt at a mnemonic. 701539Srgrimes */ 711539Srgrimes 721539Srgrimes/* stdio buffers */ 731539Srgrimesstruct __sbuf { 741539Srgrimes unsigned char *_base; 751539Srgrimes int _size; 761539Srgrimes}; 771539Srgrimes 7872529Simp/* hold a buncha junk that would grow the ABI */ 7973254Sdeischenstruct __sFILEX; 8072529Simp 811539Srgrimes/* 821539Srgrimes * stdio state variables. 831539Srgrimes * 841539Srgrimes * The following always hold: 851539Srgrimes * 861539Srgrimes * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), 871539Srgrimes * _lbfsize is -_bf._size, else _lbfsize is 0 881539Srgrimes * if _flags&__SRD, _w is 0 891539Srgrimes * if _flags&__SWR, _r is 0 901539Srgrimes * 911539Srgrimes * This ensures that the getc and putc macros (or inline functions) never 921539Srgrimes * try to write or read from a file that is in `read' or `write' mode. 931539Srgrimes * (Moreover, they can, and do, automatically switch from read mode to 941539Srgrimes * write mode, and back, on "r+" and "w+" files.) 951539Srgrimes * 961539Srgrimes * _lbfsize is used only to make the inline line-buffered output stream 971539Srgrimes * code as compact as possible. 981539Srgrimes * 991539Srgrimes * _ub, _up, and _ur are used when ungetc() pushes back more characters 1001539Srgrimes * than fit in the current _bf, or when ungetc() pushes back a character 1011539Srgrimes * that does not match the previous one in _bf. When this happens, 1021539Srgrimes * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff 1031539Srgrimes * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. 1041539Srgrimes * 1051539Srgrimes * NB: see WARNING above before changing the layout of this structure! 1061539Srgrimes */ 1071539Srgrimestypedef struct __sFILE { 1081539Srgrimes unsigned char *_p; /* current position in (some) buffer */ 1091539Srgrimes int _r; /* read space left for getc() */ 1101539Srgrimes int _w; /* write space left for putc() */ 1111539Srgrimes short _flags; /* flags, below; this FILE is free if 0 */ 1121539Srgrimes short _file; /* fileno, if Unix descriptor, else -1 */ 1131539Srgrimes struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ 1141539Srgrimes int _lbfsize; /* 0 or -_bf._size, for inline putc */ 1151539Srgrimes 1161539Srgrimes /* operations */ 1171539Srgrimes void *_cookie; /* cookie passed to io functions */ 11893032Simp int (*_close)(void *); 11993032Simp int (*_read)(void *, char *, int); 12093032Simp fpos_t (*_seek)(void *, fpos_t, int); 12193032Simp int (*_write)(void *, const char *, int); 1221539Srgrimes 1231539Srgrimes /* separate buffer for long sequences of ungetc() */ 1241539Srgrimes struct __sbuf _ub; /* ungetc buffer */ 12572529Simp struct __sFILEX *_extra; /* additions to FILE to not break ABI */ 1261539Srgrimes int _ur; /* saved _r when _r is counting ungetc data */ 1271539Srgrimes 1281539Srgrimes /* tricks to meet minimum requirements even when malloc() fails */ 1291539Srgrimes unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ 1301539Srgrimes unsigned char _nbuf[1]; /* guarantee a getc() buffer */ 1311539Srgrimes 1321539Srgrimes /* separate buffer for fgetln() when line crosses buffer boundary */ 1331539Srgrimes struct __sbuf _lb; /* buffer for fgetln() */ 1341539Srgrimes 1351539Srgrimes /* Unix stdio files get aligned to block boundaries on fseek() */ 1361539Srgrimes int _blksize; /* stat.st_blksize (may be != _bf._size) */ 1371539Srgrimes fpos_t _offset; /* current lseek offset (see WARNING) */ 1381539Srgrimes} FILE; 1391539Srgrimes 1401539Srgrimes__BEGIN_DECLS 14172529Simpextern FILE __sF[]; 14281600Speterextern FILE *__stdinp; 14381600Speterextern FILE *__stdoutp; 14481600Speterextern FILE *__stderrp; 1451539Srgrimes__END_DECLS 1461539Srgrimes 1471539Srgrimes#define __SLBF 0x0001 /* line buffered */ 1481539Srgrimes#define __SNBF 0x0002 /* unbuffered */ 1491539Srgrimes#define __SRD 0x0004 /* OK to read */ 1501539Srgrimes#define __SWR 0x0008 /* OK to write */ 1511539Srgrimes /* RD and WR are never simultaneously asserted */ 1521539Srgrimes#define __SRW 0x0010 /* open for reading & writing */ 1531539Srgrimes#define __SEOF 0x0020 /* found EOF */ 1541539Srgrimes#define __SERR 0x0040 /* found error */ 1551539Srgrimes#define __SMBF 0x0080 /* _buf is from malloc */ 1561539Srgrimes#define __SAPP 0x0100 /* fdopen()ed in append mode */ 1571539Srgrimes#define __SSTR 0x0200 /* this is an sprintf/snprintf string */ 15813771Smpp#define __SOPT 0x0400 /* do fseek() optimization */ 15913771Smpp#define __SNPT 0x0800 /* do not do fseek() optimization */ 1601539Srgrimes#define __SOFF 0x1000 /* set iff _offset is in fact correct */ 1611539Srgrimes#define __SMOD 0x2000 /* true => fgetln modified _p text */ 16237489Speter#define __SALC 0x4000 /* allocate string space dynamically */ 16372372Sdeischen#define __SIGN 0x8000 /* ignore this file in _fwalk */ 1641539Srgrimes 1651539Srgrimes/* 1661539Srgrimes * The following three definitions are for ANSI C, which took them 1671539Srgrimes * from System V, which brilliantly took internal interface macros and 1681539Srgrimes * made them official arguments to setvbuf(), without renaming them. 1691539Srgrimes * Hence, these ugly _IOxxx names are *supposed* to appear in user code. 1701539Srgrimes * 1711539Srgrimes * Although numbered as their counterparts above, the implementation 1721539Srgrimes * does not rely on this. 1731539Srgrimes */ 1741539Srgrimes#define _IOFBF 0 /* setvbuf should set fully buffered */ 1751539Srgrimes#define _IOLBF 1 /* setvbuf should set line buffered */ 1761539Srgrimes#define _IONBF 2 /* setvbuf should set unbuffered */ 1771539Srgrimes 1781539Srgrimes#define BUFSIZ 1024 /* size of buffer used by setbuf */ 1791539Srgrimes#define EOF (-1) 1801539Srgrimes 1811539Srgrimes/* 1821539Srgrimes * FOPEN_MAX is a minimum maximum, and is the number of streams that 1831539Srgrimes * stdio can provide without attempting to allocate further resources 1841539Srgrimes * (which could fail). Do not use this for anything. 1851539Srgrimes */ 1861539Srgrimes /* must be == _POSIX_STREAM_MAX <limits.h> */ 1871539Srgrimes#define FOPEN_MAX 20 /* must be <= OPEN_MAX <sys/syslimits.h> */ 1881539Srgrimes#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */ 1891539Srgrimes 1901539Srgrimes/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ 191100133Swollman#if __XSI_VISIBLE 1921539Srgrimes#define P_tmpdir "/var/tmp/" 1931539Srgrimes#endif 1941539Srgrimes#define L_tmpnam 1024 /* XXX must be == PATH_MAX */ 1951539Srgrimes#define TMP_MAX 308915776 1961539Srgrimes 1971539Srgrimes#ifndef SEEK_SET 1981539Srgrimes#define SEEK_SET 0 /* set file offset to offset */ 1991539Srgrimes#endif 2001539Srgrimes#ifndef SEEK_CUR 2011539Srgrimes#define SEEK_CUR 1 /* set file offset to current plus offset */ 2021539Srgrimes#endif 2031539Srgrimes#ifndef SEEK_END 2041539Srgrimes#define SEEK_END 2 /* set file offset to EOF plus offset */ 2051539Srgrimes#endif 2061539Srgrimes 20781600Speter/* To be removed by 5.0-RELEASE */ 20883712Speter#if (defined(__i386__) || defined(__alpha__)) && defined(_OLD_STDIO) 20972529Simp#define stdin (&__sF[0]) 21072529Simp#define stdout (&__sF[1]) 21172529Simp#define stderr (&__sF[2]) 21281600Speter#else 21381600Speter#define stdin __stdinp 21481600Speter#define stdout __stdoutp 21581600Speter#define stderr __stderrp 21681600Speter#endif 2171539Srgrimes 218100133Swollman__BEGIN_DECLS 2191539Srgrimes/* 2201539Srgrimes * Functions defined in ANSI C standard. 221104585Smike * 222104585Smike * XXX fgetpos(), fgets(), fopen(), fputs(), fread(), freopen(), fscanf(), 223104585Smike * fwrite(), scanf(), sscanf(), vscanf(), and vsscanf() are missing the 224104585Smike * restrict type-qualifier. 2251539Srgrimes */ 22693032Simpvoid clearerr(FILE *); 22793032Simpint fclose(FILE *); 22893032Simpint feof(FILE *); 22993032Simpint ferror(FILE *); 23093032Simpint fflush(FILE *); 23193032Simpint fgetc(FILE *); 23293032Simpint fgetpos(FILE *, fpos_t *); 23393032Simpchar *fgets(char *, int, FILE *); 23493032SimpFILE *fopen(const char *, const char *); 235103012Stjrint fprintf(FILE * __restrict, const char * __restrict, ...); 23693032Simpint fputc(int, FILE *); 23793032Simpint fputs(const char *, FILE *); 23893032Simpsize_t fread(void *, size_t, size_t, FILE *); 23993032SimpFILE *freopen(const char *, const char *, FILE *); 24093032Simpint fscanf(FILE *, const char *, ...); 24193032Simpint fseek(FILE *, long, int); 24293032Simpint fsetpos(FILE *, const fpos_t *); 24393032Simplong ftell(FILE *); 24493032Simpsize_t fwrite(const void *, size_t, size_t, FILE *); 24593032Simpint getc(FILE *); 24693032Simpint getchar(void); 24793032Simpchar *gets(char *); 24893032Simpvoid perror(const char *); 249103012Stjrint printf(const char * __restrict, ...); 25093032Simpint putc(int, FILE *); 25193032Simpint putchar(int); 25293032Simpint puts(const char *); 25393032Simpint remove(const char *); 25493032Simpint rename(const char *, const char *); 25593032Simpvoid rewind(FILE *); 25693032Simpint scanf(const char *, ...); 257103012Stjrvoid setbuf(FILE * __restrict, char * __restrict); 258103012Stjrint setvbuf(FILE * __restrict, char * __restrict, int, size_t); 259103012Stjrint sprintf(char * __restrict, const char * __restrict, ...); 26093032Simpint sscanf(const char *, const char *, ...); 26193032SimpFILE *tmpfile(void); 26293032Simpchar *tmpnam(char *); 26393032Simpint ungetc(int, FILE *); 264103012Stjrint vfprintf(FILE * __restrict, const char * __restrict, 265102227Smike __va_list); 266103012Stjrint vprintf(const char * __restrict, __va_list); 267103012Stjrint vsprintf(char * __restrict, const char * __restrict, 268102227Smike __va_list); 2691539Srgrimes 270100133Swollman#if __ISO_C_VISIBLE >= 1999 271103012Stjrint snprintf(char * __restrict, size_t, const char * __restrict, 272101914Srobert ...) __printflike(3, 4); 273104585Smikeint vscanf(const char *, __va_list) __scanflike(1, 0); 274103012Stjrint vsnprintf(char * __restrict, size_t, const char * __restrict, 275102227Smike __va_list) __printflike(3, 0); 276104585Smikeint vsscanf(const char *, const char *, __va_list) 277104585Smike __scanflike(2, 0); 278104585Smike 279104585Smike/* 280104585Smike * This is a #define because the function is used internally and 281104585Smike * (unlike vfscanf) the name __vfscanf is guaranteed not to collide 282104585Smike * with a user function when _ANSI_SOURCE or _POSIX_SOURCE is defined. 283104585Smike * 284104585Smike * XXX missing a backing function (weak alias?) for this. 285104585Smike */ 286104585Smike#define vfscanf __vfscanf 287100133Swollman#endif 288100133Swollman 2891539Srgrimes/* 290100133Swollman * Functions defined in all versions of POSIX 1003.1. 2911539Srgrimes */ 292104585Smike#if __BSD_VISIBLE || __POSIX_VISIBLE <= 199506 29319211Swosch/* size for cuserid(3); UT_NAMESIZE + 1, see <utmp.h> */ 294104585Smike#define L_cuserid 17 /* legacy */ 295104585Smike#endif 2961539Srgrimes 297104585Smike#if __POSIX_VISIBLE 29819211Swosch#define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ 29919211Swosch 30093032Simpchar *ctermid(char *); 30193032SimpFILE *fdopen(int, const char *); 30293032Simpint fileno(FILE *); 303100133Swollman#endif /* __POSIX_VISIBLE */ 304100133Swollman 305100133Swollman#if __POSIX_VISIBLE >= 199209 306100133Swollmanint pclose(FILE *); 307100133SwollmanFILE *popen(const char *, const char *); 308100133Swollman#endif 309100133Swollman 310100133Swollman#if __POSIX_VISIBLE >= 199506 31193032Simpint ftrylockfile(FILE *); 31293032Simpvoid flockfile(FILE *); 31393032Simpvoid funlockfile(FILE *); 3141539Srgrimes 3151539Srgrimes/* 316100133Swollman * These are normally used through macros as defined below, but POSIX 317100133Swollman * requires functions as well. 31824897Sbde */ 319100133Swollmanint getc_unlocked(FILE *); 320100133Swollmanint getchar_unlocked(void); 321100133Swollmanint putc_unlocked(int, FILE *); 322100133Swollmanint putchar_unlocked(int); 32324897Sbde#endif 324100133Swollman 325100133Swollman#if __POSIX_VISIBLE >= 200112 326102227Smikeint fseeko(FILE *, __off_t, int); 327102227Smike__off_t ftello(FILE *); 32824897Sbde#endif 329100133Swollman 330100133Swollman#if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 331100133Swollmanint getw(FILE *); 332100133Swollmanint putw(int, FILE *); 333100133Swollman#endif /* BSD or X/Open before issue 6 */ 334100133Swollman 335100133Swollman#if __XSI_VISIBLE 336100133Swollmanchar *tempnam(const char *, const char *); 33724897Sbde#endif 33824897Sbde 33924897Sbde/* 3401539Srgrimes * Routines that are purely local. 3411539Srgrimes */ 342100133Swollman#if __BSD_VISIBLE 34393032Simpint asprintf(char **, const char *, ...) __printflike(2, 3); 34493032Simpchar *ctermid_r(char *); 34593032Simpchar *fgetln(FILE *, size_t *); 34687369Sobrien#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3 34787369Sobrien#define __ATTR_FORMAT_ARG __attribute__((__format_arg__(2))) 34887369Sobrien#else 34987369Sobrien#define __ATTR_FORMAT_ARG 35087369Sobrien#endif 35193032Simp__const char *fmtcheck(const char *, const char *) __ATTR_FORMAT_ARG; 35293032Simpint fpurge(FILE *); 35393032Simpvoid setbuffer(FILE *, char *, int); 35493032Simpint setlinebuf(FILE *); 355102227Smikeint vasprintf(char **, const char *, __va_list) 35637614Sbde __printflike(2, 0); 3571539Srgrimes 3581539Srgrimes/* 359100133Swollman * The system error table contains messages for the first sys_nerr 360100133Swollman * positive errno values. Use strerror() or strerror_r() from <string.h> 361100133Swollman * instead. 362100133Swollman */ 363100133Swollmanextern __const int sys_nerr; 364100133Swollmanextern __const char *__const sys_errlist[]; 365100133Swollman 366100133Swollman/* 3671539Srgrimes * Stdio function-access interface. 3681539Srgrimes */ 36993032SimpFILE *funopen(const void *, 37075818Sobrien int (*)(void *, char *, int), 37175818Sobrien int (*)(void *, const char *, int), 37275818Sobrien fpos_t (*)(void *, fpos_t, int), 37393032Simp int (*)(void *)); 3741539Srgrimes#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) 3751539Srgrimes#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) 3761539Srgrimes 3771539Srgrimes/* 378100133Swollman * Portability hacks. See <sys/types.h>. 379100133Swollman */ 380100133Swollman#ifndef _FTRUNCATE_DECLARED 381100133Swollman#define _FTRUNCATE_DECLARED 382102227Smikeint ftruncate(int, __off_t); 383100133Swollman#endif 384100133Swollman#ifndef _LSEEK_DECLARED 385100133Swollman#define _LSEEK_DECLARED 386102227Smike__off_t lseek(int, __off_t, int); 387100133Swollman#endif 388100133Swollman#ifndef _MMAP_DECLARED 389100133Swollman#define _MMAP_DECLARED 390102227Smikevoid *mmap(void *, size_t, int, int, int, __off_t); 391100133Swollman#endif 392100133Swollman#ifndef _TRUNCATE_DECLARED 393100133Swollman#define _TRUNCATE_DECLARED 394102227Smikeint truncate(const char *, __off_t); 395100133Swollman#endif 396100133Swollman#endif /* __BSD_VISIBLE */ 397100133Swollman 398100133Swollman/* 3991539Srgrimes * Functions internal to the implementation. 4001539Srgrimes */ 40193032Simpint __srget(FILE *); 402102227Smikeint __vfscanf(FILE *, const char *, __va_list); 403102227Smikeint __svfscanf(FILE *, const char *, __va_list); 40493032Simpint __swbuf(int, FILE *); 4051539Srgrimes 4061539Srgrimes/* 4078858Srgrimes * The __sfoo macros are here so that we can 4081539Srgrimes * define function versions in the C library. 4091539Srgrimes */ 4101539Srgrimes#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) 4111539Srgrimes#if defined(__GNUC__) && defined(__STDC__) 4121539Srgrimesstatic __inline int __sputc(int _c, FILE *_p) { 4131539Srgrimes if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) 4141539Srgrimes return (*_p->_p++ = _c); 4151539Srgrimes else 4161539Srgrimes return (__swbuf(_c, _p)); 4171539Srgrimes} 4181539Srgrimes#else 4191539Srgrimes/* 4201539Srgrimes * This has been tuned to generate reasonable code on the vax using pcc. 4211539Srgrimes */ 4221539Srgrimes#define __sputc(c, p) \ 4231539Srgrimes (--(p)->_w < 0 ? \ 4241539Srgrimes (p)->_w >= (p)->_lbfsize ? \ 4251539Srgrimes (*(p)->_p = (c)), *(p)->_p != '\n' ? \ 4261539Srgrimes (int)*(p)->_p++ : \ 4271539Srgrimes __swbuf('\n', p) : \ 4281539Srgrimes __swbuf((int)(c), p) : \ 4291539Srgrimes (*(p)->_p = (c), (int)*(p)->_p++)) 4301539Srgrimes#endif 4311539Srgrimes 4321539Srgrimes#define __sfeof(p) (((p)->_flags & __SEOF) != 0) 4331539Srgrimes#define __sferror(p) (((p)->_flags & __SERR) != 0) 4341539Srgrimes#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) 4351539Srgrimes#define __sfileno(p) ((p)->_file) 4361539Srgrimes 437104585Smike#if __BSD_VISIBLE 43835127Sjb/* 43935127Sjb * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12 44035127Sjb * B.8.2.7 for the rationale behind the *_unlocked() macros. 44135127Sjb */ 44235127Sjb#define feof_unlocked(p) __sfeof(p) 44335127Sjb#define ferror_unlocked(p) __sferror(p) 44435127Sjb#define clearerr_unlocked(p) __sclearerr(p) 44535127Sjb#define fileno_unlocked(p) __sfileno(p) 446104585Smike#endif 447104585Smike#if __POSIX_VISIBLE >= 199506 44835127Sjb#define getc_unlocked(fp) __sgetc(fp) 44971580Sdeischen#define putc_unlocked(x, fp) __sputc(x, fp) 4501539Srgrimes 45135127Sjb#define getchar_unlocked() getc_unlocked(stdin) 45235127Sjb#define putchar_unlocked(x) putc_unlocked(x, stdout) 453104585Smike#endif 45424897Sbde 455100133Swollman__END_DECLS 45624897Sbde#endif /* !_STDIO_H_ */ 457