gonzui


Format: Advanced Search

t2ex/bsd_source/t2ex/network/net/include/netbsd/stdio.hbare sourcepermlink (0.03 seconds)

Search this content:

    1: /*      $NetBSD: stdio.h,v 1.73 2008/09/21 16:59:46 christos Exp $   */
    2: 
    3: /*-
    4:  * Copyright (c) 1990, 1993
    5:  *      The Regents of the University of California.  All rights reserved.
    6:  *
    7:  * This code is derived from software contributed to Berkeley by
    8:  * Chris Torek.
    9:  *
   10:  * Redistribution and use in source and binary forms, with or without
   11:  * modification, are permitted provided that the following conditions
   12:  * are met:
   13:  * 1. Redistributions of source code must retain the above copyright
   14:  *    notice, this list of conditions and the following disclaimer.
   15:  * 2. Redistributions in binary form must reproduce the above copyright
   16:  *    notice, this list of conditions and the following disclaimer in the
   17:  *    documentation and/or other materials provided with the distribution.
   18:  * 3. Neither the name of the University nor the names of its contributors
   19:  *    may be used to endorse or promote products derived from this software
   20:  *    without specific prior written permission.
   21:  *
   22:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   23:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   24:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   25:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   26:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   27:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   28:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   29:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   30:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   31:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   32:  * SUCH DAMAGE.
   33:  *
   34:  *      @(#)stdio.h  8.5 (Berkeley) 4/29/95
   35:  */
   36: 
   37: #ifndef _STDIO_H_
   38: #define _STDIO_H_
   39: 
   40: #include <sys/cdefs.h>
   41: #include <sys/featuretest.h>
   42: #include <sys/ansi.h>
   43: 
   44: #include <machine/ansi.h>
   45: 
   46: #ifdef T2EX
   47: #include <sys/types.h>
   48: #endif
   49: 
   50: #ifndef T2EX
   51: #ifdef  _BSD_SIZE_T_
   52: typedef _BSD_SIZE_T_    size_t;
   53: #undef  _BSD_SIZE_T_
   54: #endif
   55: #else
   56: #ifdef  __size_t
   57: typedef __size_t        size_t;
   58: #undef  __size_t
   59: #endif
   60: #endif
   61: 
   62: #include <sys/null.h>
   63: 
   64: /*      
   65:  * This is fairly grotesque, but pure ANSI code must not inspect the
   66:  * innards of an fpos_t anyway.  The library internally uses off_t,
   67:  * which we assume is exactly as big as eight chars.
   68:  */
   69: #ifdef T2EX
   70: #ifdef  __off_t
   71: typedef __off_t         off_t;
   72: #undef  __off_t
   73: #endif
   74: #define __off_t         off_t
   75: #endif
   76: #if (!defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__)) || defined(_LIBC)
   77: typedef __off_t fpos_t;
   78: #else
   79: typedef struct __sfpos {
   80:         __off_t _pos;
   81: } fpos_t;
   82: #endif
   83: #ifdef T2EX
   84: #undef __off_t
   85: #endif
   86: 
   87: #define _FSTDIO                 /* Define for new stdio with functions. */
   88: 
   89: /*
   90:  * NB: to fit things in six character monocase externals, the stdio
   91:  * code uses the prefix `__s' for stdio objects, typically followed
   92:  * by a three-character attempt at a mnemonic.
   93:  */
   94: 
   95: /* stdio buffers */
   96: struct __sbuf {
   97:         unsigned char *_base;
   98:         int    _size;
   99: };
  100: 
  101: /*
  102:  * stdio state variables.
  103:  *
  104:  * The following always hold:
  105:  *
  106:  *      if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
  107:  *              _lbfsize is -_bf._size, else _lbfsize is 0
  108:  *      if _flags&__SRD, _w is 0
  109:  *      if _flags&__SWR, _r is 0
  110:  *
  111:  * This ensures that the getc and putc macros (or inline functions) never
  112:  * try to write or read from a file that is in `read' or `write' mode.
  113:  * (Moreover, they can, and do, automatically switch from read mode to
  114:  * write mode, and back, on "r+" and "w+" files.)
  115:  *
  116:  * _lbfsize is used only to make the inline line-buffered output stream
  117:  * code as compact as possible.
  118:  *
  119:  * _ub, _up, and _ur are used when ungetc() pushes back more characters
  120:  * than fit in the current _bf, or when ungetc() pushes back a character
  121:  * that does not match the previous one in _bf.  When this happens,
  122:  * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
  123:  * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
  124:  *
  125:  * NB: see WARNING above before changing the layout of this structure!
  126:  */
  127: typedef struct __sFILE {
  128:         unsigned char *_p;     /* current position in (some) buffer */
  129:         int    _r;                /* read space left for getc() */
  130:         int    _w;                /* write space left for putc() */
  131:         unsigned short _flags; /* flags, below; this FILE is free if 0 */
  132:         short  _file;           /* fileno, if Unix descriptor, else -1 */
  133:         struct __sbuf _bf;     /* the buffer (at least 1 byte, if !NULL) */
  134:         int    _lbfsize;  /* 0 or -_bf._size, for inline putc */
  135: 
  136:         /* operations */
  137:         void   *_cookie; /* cookie passed to io functions */
  138:         int    (*_close)(void *);
  139:         int    (*_read) (void *, char *, int);
  140:         fpos_t (*_seek) (void *, fpos_t, int);
  141:         int    (*_write)(void *, const char *, int);
  142: 
  143:         /* file extension */
  144:         struct __sbuf _ext;
  145: 
  146:         /* separate buffer for long sequences of ungetc() */
  147:         unsigned char *_up;    /* saved _p when _p is doing ungetc data */
  148:         int    _ur;               /* saved _r when _r is counting ungetc data */
  149: 
  150:         /* tricks to meet minimum requirements even when malloc() fails */
  151:         unsigned char _ubuf[3];        /* guarantee an ungetc() buffer */
  152:         unsigned char _nbuf[1];        /* guarantee a getc() buffer */
  153: 
  154:         /* separate buffer for fgetln() when line crosses buffer boundary */
  155:         struct __sbuf _lb;     /* buffer for fgetln() */
  156: 
  157:         /* Unix stdio files get aligned to block boundaries on fseek() */
  158:         int    _blksize;  /* stat.st_blksize (may be != _bf._size) */
  159:         fpos_t _offset;        /* current lseek offset */
  160: } FILE;
  161: 
  162: __BEGIN_DECLS
  163: extern FILE __sF[];
  164: __END_DECLS
  165: 
  166: #define __SLBF  0x0001           /* line buffered */
  167: #define __SNBF  0x0002           /* unbuffered */
  168: #define __SRD   0x0004            /* OK to read */
  169: #define __SWR   0x0008            /* OK to write */
  170:         /* RD and WR are never simultaneously asserted */
  171: #define __SRW   0x0010            /* open for reading & writing */
  172: #define __SEOF  0x0020           /* found EOF */
  173: #define __SERR  0x0040           /* found error */
  174: #define __SMBF  0x0080           /* _buf is from malloc */
  175: #define __SAPP  0x0100           /* fdopen()ed in append mode */
  176: #define __SSTR  0x0200           /* this is an sprintf/snprintf string */
  177: #define __SOPT  0x0400           /* do fseek() optimization */
  178: #define __SNPT  0x0800           /* do not do fseek() optimization */
  179: #define __SOFF  0x1000           /* set iff _offset is in fact correct */
  180: #define __SMOD  0x2000           /* true => fgetln modified _p text */
  181: #define __SALC  0x4000           /* allocate string space dynamically */
  182: 
  183: /*
  184:  * The following three definitions are for ANSI C, which took them
  185:  * from System V, which brilliantly took internal interface macros and
  186:  * made them official arguments to setvbuf(), without renaming them.
  187:  * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
  188:  *
  189:  * Although numbered as their counterparts above, the implementation
  190:  * does not rely on this.
  191:  */
  192: #define _IOFBF  0                /* setvbuf should set fully buffered */
  193: #define _IOLBF  1                /* setvbuf should set line buffered */
  194: #define _IONBF  2                /* setvbuf should set unbuffered */
  195: 
  196: #define BUFSIZ  1024             /* size of buffer used by setbuf */
  197: #define EOF     (-1)
  198: 
  199: /*
  200:  * FOPEN_MAX is a minimum maximum, and is the number of streams that
  201:  * stdio can provide without attempting to allocate further resources
  202:  * (which could fail).  Do not use this for anything.
  203:  */
  204:                                 /* must be == _POSIX_STREAM_MAX <limits.h> */
  205: #define FOPEN_MAX       20    /* must be <= OPEN_MAX <sys/syslimits.h> */
  206: #define FILENAME_MAX    1024       /* must be <= PATH_MAX <sys/syslimits.h> */
  207: 
  208: /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
  209: #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
  210: #define P_tmpdir        "/var/tmp/"
  211: #endif
  212: #define L_tmpnam        1024   /* XXX must be == PATH_MAX */
  213: /* Always ensure that this is consistent with <limits.h> */
  214: #ifndef TMP_MAX
  215: #define TMP_MAX                 308915776     /* Legacy */
  216: #endif
  217: 
  218: /* Always ensure that these are consistent with <fcntl.h> and <unistd.h>! */
  219: #ifndef SEEK_SET
  220: #define SEEK_SET        0      /* set file offset to offset */
  221: #endif
  222: #ifndef SEEK_CUR
  223: #define SEEK_CUR        1      /* set file offset to current plus offset */
  224: #endif
  225: #ifndef SEEK_END
  226: #define SEEK_END        2      /* set file offset to EOF plus offset */
  227: #endif
  228: 
  229: #define stdin   (&__sF[0])
  230: #define stdout  (&__sF[1])
  231: #define stderr  (&__sF[2])
  232: 
  233: /*
  234:  * Functions defined in ANSI C standard.
  235:  */
  236: __BEGIN_DECLS
  237: void     clearerr(FILE *);
  238: int      fclose(FILE *);
  239: int      feof(FILE *);
  240: int      ferror(FILE *);
  241: int      fflush(FILE *);
  242: int      fgetc(FILE *);
  243: int      fgetpos(FILE * __restrict, fpos_t * __restrict);
  244: char    *fgets(char * __restrict, int, FILE * __restrict);
  245: FILE    *fopen(const char * __restrict , const char * __restrict);
  246: int      fprintf(FILE * __restrict , const char * __restrict, ...)
  247:     __attribute__((__format__(__printf__, 2, 3)));
  248: int      fputc(int, FILE *);
  249: int      fputs(const char * __restrict, FILE * __restrict);
  250: size_t   fread(void * __restrict, size_t, size_t, FILE * __restrict);
  251: FILE    *freopen(const char * __restrict, const char * __restrict,
  252:             FILE * __restrict);
  253: int      fscanf(FILE * __restrict, const char * __restrict, ...)
  254:     __attribute__((__format__(__scanf__, 2, 3)));
  255: int      fseek(FILE *, long, int);
  256: int      fsetpos(FILE *, const fpos_t *);
  257: long     ftell(FILE *);
  258: size_t   fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
  259: int      getc(FILE *);
  260: int      getchar(void);
  261: void     perror(const char *);
  262: int      printf(const char * __restrict, ...)
  263:     __attribute__((__format__(__printf__, 1, 2)));
  264: int      putc(int, FILE *);
  265: int      putchar(int);
  266: int      puts(const char *);
  267: int      remove(const char *);
  268: void     rewind(FILE *);
  269: int      scanf(const char * __restrict, ...)
  270:     __attribute__((__format__(__scanf__, 1, 2)));
  271: void     setbuf(FILE * __restrict, char * __restrict);
  272: int      setvbuf(FILE * __restrict, char * __restrict, int, size_t);
  273: int      sscanf(const char * __restrict, const char * __restrict, ...)
  274:     __attribute__((__format__(__scanf__, 2, 3)));
  275: FILE    *tmpfile(void);
  276: int      ungetc(int, FILE *);
  277: int      vfprintf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_)
  278:     __attribute__((__format__(__printf__, 2, 0)));
  279: int      vprintf(const char * __restrict, _BSD_VA_LIST_)
  280:     __attribute__((__format__(__printf__, 1, 0)));
  281: 
  282: #ifndef __AUDIT__
  283: char    *gets(char *);
  284: int      sprintf(char * __restrict, const char * __restrict, ...)
  285:     __attribute__((__format__(__printf__, 2, 3)));
  286: char    *tmpnam(char *);
  287: int      vsprintf(char * __restrict, const char * __restrict,
  288:     _BSD_VA_LIST_)
  289:     __attribute__((__format__(__printf__, 2, 0)));
  290: #endif
  291: 
  292: #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
  293: int      rename (const char *, const char *) __RENAME(__posix_rename);
  294: #else
  295: int      rename (const char *, const char *);
  296: #endif
  297: __END_DECLS
  298: 
  299: /*
  300:  * IEEE Std 1003.1-90
  301:  */
  302: #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
  303:     defined(_NETBSD_SOURCE)
  304: #define L_ctermid       1024  /* size for ctermid(); PATH_MAX */
  305: #define L_cuserid       9     /* size for cuserid(); UT_NAMESIZE + 1 */
  306: 
  307: __BEGIN_DECLS
  308: char    *ctermid(char *);
  309: #ifndef __CUSERID_DECLARED
  310: #define __CUSERID_DECLARED
  311: /* also declared in unistd.h */
  312: char    *cuserid(char *);
  313: #endif /* __CUSERID_DECLARED */
  314: FILE    *fdopen(int, const char *);
  315: int      fileno(FILE *);
  316: __END_DECLS
  317: #endif /* not ANSI */
  318: 
  319: /*
  320:  * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
  321:  */
  322: #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
  323:     defined(_REENTRANT) || defined(_NETBSD_SOURCE)
  324: __BEGIN_DECLS
  325: void    flockfile(FILE *);
  326: int     ftrylockfile(FILE *);
  327: void    funlockfile(FILE *);
  328: int     getc_unlocked(FILE *);
  329: int     getchar_unlocked(void);
  330: int     putc_unlocked(int, FILE *);
  331: int     putchar_unlocked(int);
  332: __END_DECLS
  333: #endif /* _POSIX_C_SOURCE >= 1995056 || _XOPEN_SOURCE >= 500 || ... */
  334: 
  335: /*
  336:  * Functions defined in POSIX 1003.2 and XPG2 or later.
  337:  */
  338: #if (_POSIX_C_SOURCE - 0) >= 2 || (_XOPEN_SOURCE - 0) >= 2 || \
  339:     defined(_NETBSD_SOURCE)
  340: __BEGIN_DECLS
  341: int      pclose(FILE *);
  342: FILE    *popen(const char *, const char *);
  343: __END_DECLS
  344: #endif
  345: 
  346: /*
  347:  * Functions defined in ISO XPG4.2, ISO C99, POSIX 1003.1-2001 or later.
  348:  */
  349: #if ((__STDC_VERSION__ - 0) >= 199901L) || \
  350:     ((_POSIX_C_SOURCE - 0) >= 200112L) || \
  351:     (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
  352:     ((_XOPEN_SOURCE - 0) >= 500) || \
  353:     defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
  354: __BEGIN_DECLS
  355: int      snprintf(char * __restrict, size_t, const char * __restrict, ...)
  356:     __attribute__((__format__(__printf__, 3, 4)));
  357: int      vsnprintf(char * __restrict, size_t, const char * __restrict,
  358:             _BSD_VA_LIST_)
  359:     __attribute__((__format__(__printf__, 3, 0)));
  360: __END_DECLS
  361: #endif
  362: 
  363: /*
  364:  * Functions defined in XPG4.2.
  365:  */
  366: #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
  367: __BEGIN_DECLS
  368: int      getw(FILE *);
  369: int      putw(int, FILE *);
  370: 
  371: #ifndef __AUDIT__
  372: char    *tempnam(const char *, const char *);
  373: #endif
  374: __END_DECLS
  375: #endif
  376: 
  377: /*
  378:  * X/Open CAE Specification Issue 5 Version 2
  379:  */
  380: #if (_XOPEN_SOURCE - 0) >= 500 || defined(_LARGEFILE_SOURCE) || \
  381:     defined(_NETBSD_SOURCE)
  382: 
  383: #ifndef T2EX
  384: #ifndef off_t
  385: typedef __off_t         off_t;
  386: #define off_t           __off_t
  387: #endif /* off_t */
  388: #else
  389: #ifdef  __off_t
  390: typedef __off_t         off_t;
  391: #undef  __off_t
  392: #endif
  393: #endif
  394: 
  395: __BEGIN_DECLS
  396: int      fseeko(FILE *, off_t, int);
  397: off_t    ftello(FILE *);
  398: __END_DECLS
  399: #endif /* _XOPEN_SOURCE >= 500 || _LARGEFILE_SOURCE || _NETBSD_SOURCE */
  400: 
  401: /*
  402:  * Functions defined in ISO C99.  Still put under _NETBSD_SOURCE due to
  403:  * backward compatible.
  404:  */
  405: #if defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
  406: __BEGIN_DECLS
  407: int      vscanf(const char * __restrict, _BSD_VA_LIST_)
  408:     __attribute__((__format__(__scanf__, 1, 0)));
  409: int      vfscanf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_)
  410:     __attribute__((__format__(__scanf__, 2, 0)));
  411: int      vsscanf(const char * __restrict, const char * __restrict,
  412:     _BSD_VA_LIST_)
  413:     __attribute__((__format__(__scanf__, 2, 0)));
  414: __END_DECLS
  415: #endif /* _ISOC99_SOURCE || _NETBSD_SOURCE */
  416: 
  417: /*
  418:  * Routines that are purely local.
  419:  */
  420: #if defined(_NETBSD_SOURCE)
  421: 
  422: #define FPARSELN_UNESCESC       0x01
  423: #define FPARSELN_UNESCCONT      0x02
  424: #define FPARSELN_UNESCCOMM      0x04
  425: #define FPARSELN_UNESCREST      0x08
  426: #define FPARSELN_UNESCALL       0x0f
  427: 
  428: __BEGIN_DECLS
  429: int      asprintf(char ** __restrict, const char * __restrict, ...)
  430:     __attribute__((__format__(__printf__, 2, 3)));
  431: char    *fgetln(FILE * __restrict, size_t * __restrict);
  432: char    *fparseln(FILE *, size_t *, size_t *, const char[3], int);
  433: int      fpurge(FILE *);
  434: void     setbuffer(FILE *, char *, int);
  435: int      setlinebuf(FILE *);
  436: int      vasprintf(char ** __restrict, const char * __restrict,
  437:     _BSD_VA_LIST_)
  438:     __attribute__((__format__(__printf__, 2, 0)));
  439: const char *fmtcheck(const char *, const char *)
  440:     __attribute__((__format_arg__(2)));
  441: __END_DECLS
  442: 
  443: /*
  444:  * Stdio function-access interface.
  445:  */
  446: __BEGIN_DECLS
  447: FILE    *funopen(const void *,
  448:                 int (*)(void *, char *, int),
  449:                 int (*)(void *, const char *, int),
  450:                 fpos_t (*)(void *, fpos_t, int),
  451:                 int (*)(void *));
  452: __END_DECLS
  453: #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
  454: #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
  455: #endif /* _NETBSD_SOURCE */
  456: 
  457: /*
  458:  * Functions internal to the implementation.
  459:  */
  460: __BEGIN_DECLS
  461: int     __srget(FILE *);
  462: int     __swbuf(int, FILE *);
  463: __END_DECLS
  464: 
  465: /*
  466:  * The __sfoo macros are here so that we can 
  467:  * define function versions in the C library.
  468:  */
  469: #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
  470: #if defined(__GNUC__) && defined(__STDC__)
  471: static __inline int __sputc(int _c, FILE *_p) {
  472:         if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
  473:                 return (*_p->_p++ = _c);
  474:         else
  475:                 return (__swbuf(_c, _p));
  476: }
  477: #else
  478: /*
  479:  * This has been tuned to generate reasonable code on the vax using pcc.
  480:  */
  481: #define __sputc(c, p) \
  482:         (--(p)->_w < 0 ? \
  483:                 (p)->_w >= (p)->_lbfsize ? \
  484:                         (*(p)->_p = (c)), *(p)->_p != '\n' ? \
  485:                                 (int)*(p)->_p++ : \
  486:                                 __swbuf('\n', p) : \
  487:                         __swbuf((int)(c), p) : \
  488:                 (*(p)->_p = (c), (int)*(p)->_p++))
  489: #endif
  490: 
  491: #define __sfeof(p)      (((p)->_flags & __SEOF) != 0)
  492: #define __sferror(p)    (((p)->_flags & __SERR) != 0)
  493: #define __sclearerr(p)  ((void)((p)->_flags &= ~(__SERR|__SEOF)))
  494: #define __sfileno(p)    \
  495:     ((p)->_file == -1 ? -1 : (int)(unsigned short)(p)->_file)
  496: 
  497: #ifndef __lint__
  498: #if !defined(_REENTRANT) && !defined(_PTHREADS)
  499: #define feof(p)         __sfeof(p)
  500: #define ferror(p)       __sferror(p)
  501: #define clearerr(p)     __sclearerr(p)
  502: 
  503: #define getc(fp)        __sgetc(fp)
  504: #define putc(x, fp)     __sputc(x, fp)
  505: #endif /* !_REENTRANT && !_PTHREADS */
  506: #endif /* __lint__ */
  507: 
  508: #define getchar()       getc(stdin)
  509: #define putchar(x)      putc(x, stdout)
  510: 
  511: #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
  512:     defined(_NETBSD_SOURCE)
  513: #if !defined(_REENTRANT) && !defined(_PTHREADS)
  514: #define fileno(p)       __sfileno(p)
  515: #endif /* !_REENTRANT && !_PTHREADS */
  516: #endif /* !_ANSI_SOURCE */
  517: 
  518: #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
  519:     defined(_REENTRANT) || defined(_NETBSD_SOURCE)
  520: #define getc_unlocked(fp)       __sgetc(fp)
  521: #define putc_unlocked(x, fp)    __sputc(x, fp)
  522: 
  523: #define getchar_unlocked()      getc_unlocked(stdin)
  524: #define putchar_unlocked(x)     putc_unlocked(x, stdout)
  525: #endif /* _POSIX_C_SOURCE >= 199506 || _XOPEN_SOURCE >= 500 || _REENTRANT... */
  526: 
  527: #if _FORTIFY_SOURCE > 0
  528: #include <ssp/stdio.h>
  529: #endif
  530: 
  531: #endif /* _STDIO_H_ */