17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5d0983205SRoger A. Faulkner * Common Development and Distribution License (the "License"). 6d0983205SRoger A. Faulkner * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate 227c478bd9Sstevel@tonic-gate /* 23*23a1cceaSRoger A. Faulkner * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 26d0983205SRoger A. Faulkner /* Copyright (c) 1988 AT&T */ 27d0983205SRoger A. Faulkner /* All Rights Reserved */ 28d0983205SRoger A. Faulkner 297c478bd9Sstevel@tonic-gate /* 307c478bd9Sstevel@tonic-gate * User-visible pieces of the ANSI C standard I/O package. 317c478bd9Sstevel@tonic-gate */ 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #ifndef _STDIO_H 347c478bd9Sstevel@tonic-gate #define _STDIO_H 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 397c478bd9Sstevel@tonic-gate extern "C" { 407c478bd9Sstevel@tonic-gate #endif 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate /* 437c478bd9Sstevel@tonic-gate * Do all of our 'redefine_extname' processing before 447c478bd9Sstevel@tonic-gate * declarations of the associated functions are seen. 457c478bd9Sstevel@tonic-gate * This is necessary to keep gcc happy. 467c478bd9Sstevel@tonic-gate */ 477c478bd9Sstevel@tonic-gate #if defined(__PRAGMA_REDEFINE_EXTNAME) 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate /* large file compilation environment setup */ 507c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 517c478bd9Sstevel@tonic-gate #pragma redefine_extname fopen fopen64 527c478bd9Sstevel@tonic-gate #pragma redefine_extname freopen freopen64 537c478bd9Sstevel@tonic-gate #pragma redefine_extname tmpfile tmpfile64 547c478bd9Sstevel@tonic-gate #pragma redefine_extname fgetpos fgetpos64 557c478bd9Sstevel@tonic-gate #pragma redefine_extname fsetpos fsetpos64 567c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE_SOURCE) 577c478bd9Sstevel@tonic-gate #pragma redefine_extname fseeko fseeko64 587c478bd9Sstevel@tonic-gate #pragma redefine_extname ftello ftello64 597c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE_SOURCE */ 607c478bd9Sstevel@tonic-gate #endif /* !defined(_LP64) && _FILE_OFFSET_BITS == 64 */ 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate /* In the LP64 compilation environment, all APIs are already large file */ 637c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 647c478bd9Sstevel@tonic-gate #pragma redefine_extname fopen64 fopen 657c478bd9Sstevel@tonic-gate #pragma redefine_extname freopen64 freopen 667c478bd9Sstevel@tonic-gate #pragma redefine_extname tmpfile64 tmpfile 677c478bd9Sstevel@tonic-gate #pragma redefine_extname fgetpos64 fgetpos 687c478bd9Sstevel@tonic-gate #pragma redefine_extname fsetpos64 fsetpos 697c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE_SOURCE) 707c478bd9Sstevel@tonic-gate #pragma redefine_extname fseeko64 fseeko 717c478bd9Sstevel@tonic-gate #pragma redefine_extname ftello64 ftello 727c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE_SOURCE */ 737c478bd9Sstevel@tonic-gate #endif /* defined(_LP64) && defined(_LARGEFILE64_SOURCE) */ 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate #ifdef __cplusplus 787c478bd9Sstevel@tonic-gate } 797c478bd9Sstevel@tonic-gate #endif 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate #include <iso/stdio_iso.h> 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* 847c478bd9Sstevel@tonic-gate * If feature test macros are set that enable interfaces that use types 857c478bd9Sstevel@tonic-gate * defined in <sys/types.h>, get those types by doing the include. 867c478bd9Sstevel@tonic-gate * 877c478bd9Sstevel@tonic-gate * Note that in asking for the interfaces associated with this feature test 887c478bd9Sstevel@tonic-gate * macro one also asks for definitions of the POSIX types. 897c478bd9Sstevel@tonic-gate */ 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* 927c478bd9Sstevel@tonic-gate * Allow global visibility for symbols defined in 937c478bd9Sstevel@tonic-gate * C++ "std" namespace in <iso/stdio_iso.h>. 947c478bd9Sstevel@tonic-gate */ 957c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L 967c478bd9Sstevel@tonic-gate using std::FILE; 977c478bd9Sstevel@tonic-gate using std::size_t; 987c478bd9Sstevel@tonic-gate using std::fpos_t; 997c478bd9Sstevel@tonic-gate using std::remove; 1007c478bd9Sstevel@tonic-gate using std::rename; 1017c478bd9Sstevel@tonic-gate using std::tmpfile; 1027c478bd9Sstevel@tonic-gate using std::tmpnam; 1037c478bd9Sstevel@tonic-gate using std::fclose; 1047c478bd9Sstevel@tonic-gate using std::fflush; 1057c478bd9Sstevel@tonic-gate using std::fopen; 1067c478bd9Sstevel@tonic-gate using std::freopen; 1077c478bd9Sstevel@tonic-gate using std::setbuf; 1087c478bd9Sstevel@tonic-gate using std::setvbuf; 1097c478bd9Sstevel@tonic-gate using std::fprintf; 1107c478bd9Sstevel@tonic-gate using std::fscanf; 1117c478bd9Sstevel@tonic-gate using std::printf; 1127c478bd9Sstevel@tonic-gate using std::scanf; 1137c478bd9Sstevel@tonic-gate using std::sprintf; 1147c478bd9Sstevel@tonic-gate using std::sscanf; 1157c478bd9Sstevel@tonic-gate using std::vfprintf; 1167c478bd9Sstevel@tonic-gate using std::vprintf; 1177c478bd9Sstevel@tonic-gate using std::vsprintf; 1187c478bd9Sstevel@tonic-gate using std::fgetc; 1197c478bd9Sstevel@tonic-gate using std::fgets; 1207c478bd9Sstevel@tonic-gate using std::fputc; 1217c478bd9Sstevel@tonic-gate using std::fputs; 1227c478bd9Sstevel@tonic-gate using std::getc; 1237c478bd9Sstevel@tonic-gate using std::getchar; 1247c478bd9Sstevel@tonic-gate using std::gets; 1257c478bd9Sstevel@tonic-gate using std::putc; 1267c478bd9Sstevel@tonic-gate using std::putchar; 1277c478bd9Sstevel@tonic-gate using std::puts; 1287c478bd9Sstevel@tonic-gate using std::ungetc; 1297c478bd9Sstevel@tonic-gate using std::fread; 1307c478bd9Sstevel@tonic-gate using std::fwrite; 1317c478bd9Sstevel@tonic-gate using std::fgetpos; 1327c478bd9Sstevel@tonic-gate using std::fseek; 1337c478bd9Sstevel@tonic-gate using std::fsetpos; 1347c478bd9Sstevel@tonic-gate using std::ftell; 1357c478bd9Sstevel@tonic-gate using std::rewind; 1367c478bd9Sstevel@tonic-gate using std::clearerr; 1377c478bd9Sstevel@tonic-gate using std::feof; 1387c478bd9Sstevel@tonic-gate using std::ferror; 1397c478bd9Sstevel@tonic-gate using std::perror; 1407c478bd9Sstevel@tonic-gate #ifndef _LP64 1417c478bd9Sstevel@tonic-gate using std::__filbuf; 1427c478bd9Sstevel@tonic-gate using std::__flsbuf; 1437c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 1447c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */ 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate /* 1477c478bd9Sstevel@tonic-gate * This header needs to be included here because it relies on the global 1487c478bd9Sstevel@tonic-gate * visibility of FILE and size_t in the C++ environment. 1497c478bd9Sstevel@tonic-gate */ 1507c478bd9Sstevel@tonic-gate #include <iso/stdio_c99.h> 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1537c478bd9Sstevel@tonic-gate extern "C" { 1547c478bd9Sstevel@tonic-gate #endif 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE_SOURCE) || defined(_XPG5) 1577c478bd9Sstevel@tonic-gate #ifndef _OFF_T 1587c478bd9Sstevel@tonic-gate #define _OFF_T 1597c478bd9Sstevel@tonic-gate #if defined(_LP64) || _FILE_OFFSET_BITS == 32 1607c478bd9Sstevel@tonic-gate typedef long off_t; 1617c478bd9Sstevel@tonic-gate #else 1627c478bd9Sstevel@tonic-gate typedef __longlong_t off_t; 1637c478bd9Sstevel@tonic-gate #endif 1647c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE64_SOURCE 1657c478bd9Sstevel@tonic-gate #ifdef _LP64 1667c478bd9Sstevel@tonic-gate typedef off_t off64_t; 1677c478bd9Sstevel@tonic-gate #else 1687c478bd9Sstevel@tonic-gate typedef __longlong_t off64_t; 1697c478bd9Sstevel@tonic-gate #endif 1707c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE */ 1717c478bd9Sstevel@tonic-gate #endif /* _OFF_T */ 1727c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE_SOURCE */ 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE64_SOURCE 1757c478bd9Sstevel@tonic-gate #ifdef _LP64 1767c478bd9Sstevel@tonic-gate typedef fpos_t fpos64_t; 1777c478bd9Sstevel@tonic-gate #else 1787c478bd9Sstevel@tonic-gate typedef __longlong_t fpos64_t; 1797c478bd9Sstevel@tonic-gate #endif 1807c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE */ 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate /* 1837c478bd9Sstevel@tonic-gate * XPG4 requires that va_list be defined in <stdio.h> "as described in 1847c478bd9Sstevel@tonic-gate * <stdarg.h>". ANSI-C and POSIX require that the namespace of <stdio.h> 1857c478bd9Sstevel@tonic-gate * not be polluted with this name. 1867c478bd9Sstevel@tonic-gate */ 1877c478bd9Sstevel@tonic-gate #if defined(_XPG4) && !defined(_VA_LIST) 1887c478bd9Sstevel@tonic-gate #define _VA_LIST 1897c478bd9Sstevel@tonic-gate typedef __va_list va_list; 1907c478bd9Sstevel@tonic-gate #endif /* defined(_XPG4 && !defined(_VA_LIST) */ 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ 1937c478bd9Sstevel@tonic-gate defined(__XOPEN_OR_POSIX) 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate #define L_ctermid 9 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate /* Marked LEGACY in SUSv2 and removed in SUSv3 */ 1987c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 1997c478bd9Sstevel@tonic-gate #define L_cuserid 9 2007c478bd9Sstevel@tonic-gate #endif 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \ 2057c478bd9Sstevel@tonic-gate (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \ 2067c478bd9Sstevel@tonic-gate defined(_XOPEN_SOURCE) 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate #define P_tmpdir "/var/tmp/" 2097c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */ 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate #ifndef _STDIO_ALLOCATE 2127c478bd9Sstevel@tonic-gate extern unsigned char _sibuf[], _sobuf[]; 2137c478bd9Sstevel@tonic-gate #endif 2147c478bd9Sstevel@tonic-gate 2157c478bd9Sstevel@tonic-gate /* large file compilation environment setup */ 2167c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 2177c478bd9Sstevel@tonic-gate #if !defined(__PRAGMA_REDEFINE_EXTNAME) 2187c478bd9Sstevel@tonic-gate #if defined(__STDC__) 2197c478bd9Sstevel@tonic-gate extern FILE *fopen64(const char *, const char *); 2207c478bd9Sstevel@tonic-gate extern FILE *freopen64(const char *, const char *, FILE *); 2217c478bd9Sstevel@tonic-gate extern FILE *tmpfile64(void); 2227c478bd9Sstevel@tonic-gate extern int fgetpos64(FILE *, fpos_t *); 2237c478bd9Sstevel@tonic-gate extern int fsetpos64(FILE *, const fpos_t *); 2247c478bd9Sstevel@tonic-gate #else /* defined(__STDC__) */ 2257c478bd9Sstevel@tonic-gate extern FILE *fopen64(); 2267c478bd9Sstevel@tonic-gate extern FILE *freopen64(); 2277c478bd9Sstevel@tonic-gate extern FILE *tmpfile64(); 2287c478bd9Sstevel@tonic-gate extern int fgetpos64(); 2297c478bd9Sstevel@tonic-gate extern int fsetpos64(); 2307c478bd9Sstevel@tonic-gate #endif /* defined(__STDC__) */ 2317c478bd9Sstevel@tonic-gate #define fopen fopen64 2327c478bd9Sstevel@tonic-gate #define freopen freopen64 2337c478bd9Sstevel@tonic-gate #define tmpfile tmpfile64 2347c478bd9Sstevel@tonic-gate #define fgetpos fgetpos64 2357c478bd9Sstevel@tonic-gate #define fsetpos fsetpos64 2367c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE_SOURCE 2377c478bd9Sstevel@tonic-gate #define fseeko fseeko64 2387c478bd9Sstevel@tonic-gate #define ftello ftello64 2397c478bd9Sstevel@tonic-gate #endif 2407c478bd9Sstevel@tonic-gate #endif /* !__PRAGMA_REDEFINE_EXTNAME */ 2417c478bd9Sstevel@tonic-gate #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ 2427c478bd9Sstevel@tonic-gate 2437c478bd9Sstevel@tonic-gate #ifndef _LP64 2447c478bd9Sstevel@tonic-gate extern unsigned char *_bufendtab[]; 2457c478bd9Sstevel@tonic-gate extern FILE *_lastbuf; 2467c478bd9Sstevel@tonic-gate #endif 2477c478bd9Sstevel@tonic-gate 2487c478bd9Sstevel@tonic-gate /* In the LP64 compilation environment, all APIs are already large file */ 2497c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 2507c478bd9Sstevel@tonic-gate #if !defined(__PRAGMA_REDEFINE_EXTNAME) 2517c478bd9Sstevel@tonic-gate #define fopen64 fopen 2527c478bd9Sstevel@tonic-gate #define freopen64 freopen 2537c478bd9Sstevel@tonic-gate #define tmpfile64 tmpfile 2547c478bd9Sstevel@tonic-gate #define fgetpos64 fgetpos 2557c478bd9Sstevel@tonic-gate #define fsetpos64 fsetpos 2567c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE_SOURCE 2577c478bd9Sstevel@tonic-gate #define fseeko64 fseeko 2587c478bd9Sstevel@tonic-gate #define ftello64 ftello 2597c478bd9Sstevel@tonic-gate #endif 2607c478bd9Sstevel@tonic-gate #endif /* !__PRAGMA_REDEFINE_EXTNAME */ 2617c478bd9Sstevel@tonic-gate #endif /* _LP64 && _LARGEFILE64_SOURCE */ 2627c478bd9Sstevel@tonic-gate 263*23a1cceaSRoger A. Faulkner #ifndef _SSIZE_T 264*23a1cceaSRoger A. Faulkner #define _SSIZE_T 265*23a1cceaSRoger A. Faulkner #if defined(_LP64) || defined(_I32LPx) 266*23a1cceaSRoger A. Faulkner typedef long ssize_t; /* size of something in bytes or -1 */ 267*23a1cceaSRoger A. Faulkner #else 268*23a1cceaSRoger A. Faulkner typedef int ssize_t; /* (historical version) */ 269*23a1cceaSRoger A. Faulkner #endif 270*23a1cceaSRoger A. Faulkner #endif /* !_SSIZE_T */ 271*23a1cceaSRoger A. Faulkner 2727c478bd9Sstevel@tonic-gate #if defined(__STDC__) 2737c478bd9Sstevel@tonic-gate 2747c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \ 2757c478bd9Sstevel@tonic-gate (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ 2767c478bd9Sstevel@tonic-gate defined(_REENTRANT) 2777c478bd9Sstevel@tonic-gate extern char *tmpnam_r(char *); 2787c478bd9Sstevel@tonic-gate #endif 2797c478bd9Sstevel@tonic-gate 2807c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \ 2817c478bd9Sstevel@tonic-gate (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) 282*23a1cceaSRoger A. Faulkner extern int fcloseall(void); 2837c478bd9Sstevel@tonic-gate extern void setbuffer(FILE *, char *, size_t); 2847c478bd9Sstevel@tonic-gate extern int setlinebuf(FILE *); 285d0983205SRoger A. Faulkner /* PRINTFLIKE2 */ 286d0983205SRoger A. Faulkner extern int asprintf(char **, const char *, ...); 287d0983205SRoger A. Faulkner /* PRINTFLIKE2 */ 288d0983205SRoger A. Faulkner extern int vasprintf(char **, const char *, __va_list); 2897c478bd9Sstevel@tonic-gate #endif 2907c478bd9Sstevel@tonic-gate 291*23a1cceaSRoger A. Faulkner #if defined(__EXTENSIONS__) || \ 292*23a1cceaSRoger A. Faulkner (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) 293*23a1cceaSRoger A. Faulkner /* || defined(_XPG7) */ 294*23a1cceaSRoger A. Faulkner extern ssize_t getdelim(char **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD, 295*23a1cceaSRoger A. Faulkner int, FILE *_RESTRICT_KYWD); 296*23a1cceaSRoger A. Faulkner extern ssize_t getline(char **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD, 297*23a1cceaSRoger A. Faulkner FILE *_RESTRICT_KYWD); 298*23a1cceaSRoger A. Faulkner #endif /* __EXTENSIONS__ ... */ 299*23a1cceaSRoger A. Faulkner 3007c478bd9Sstevel@tonic-gate /* 3017c478bd9Sstevel@tonic-gate * The following are known to POSIX and XOPEN, but not to ANSI-C. 3027c478bd9Sstevel@tonic-gate */ 3037c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \ 3047c478bd9Sstevel@tonic-gate !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX) 3057c478bd9Sstevel@tonic-gate 3067c478bd9Sstevel@tonic-gate extern FILE *fdopen(int, const char *); 3077c478bd9Sstevel@tonic-gate extern char *ctermid(char *); 3087c478bd9Sstevel@tonic-gate extern int fileno(FILE *); 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ 3117c478bd9Sstevel@tonic-gate 3127c478bd9Sstevel@tonic-gate /* 3137c478bd9Sstevel@tonic-gate * The following are known to POSIX.1c, but not to ANSI-C or XOPEN. 3147c478bd9Sstevel@tonic-gate */ 3157c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ 3167c478bd9Sstevel@tonic-gate (_POSIX_C_SOURCE - 0 >= 199506L) 3177c478bd9Sstevel@tonic-gate extern void flockfile(FILE *); 3187c478bd9Sstevel@tonic-gate extern int ftrylockfile(FILE *); 3197c478bd9Sstevel@tonic-gate extern void funlockfile(FILE *); 3207c478bd9Sstevel@tonic-gate extern int getc_unlocked(FILE *); 3217c478bd9Sstevel@tonic-gate extern int getchar_unlocked(void); 3227c478bd9Sstevel@tonic-gate extern int putc_unlocked(int, FILE *); 3237c478bd9Sstevel@tonic-gate extern int putchar_unlocked(int); 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ 3267c478bd9Sstevel@tonic-gate 3277c478bd9Sstevel@tonic-gate /* 3287c478bd9Sstevel@tonic-gate * The following are known to XOPEN, but not to ANSI-C or POSIX. 3297c478bd9Sstevel@tonic-gate */ 3307c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ 3317c478bd9Sstevel@tonic-gate defined(_XOPEN_SOURCE) 3327c478bd9Sstevel@tonic-gate extern FILE *popen(const char *, const char *); 3337c478bd9Sstevel@tonic-gate extern char *tempnam(const char *, const char *); 3347c478bd9Sstevel@tonic-gate extern int pclose(FILE *); 3357c478bd9Sstevel@tonic-gate #if !defined(_XOPEN_SOURCE) 3367c478bd9Sstevel@tonic-gate extern int getsubopt(char **, char *const *, char **); 3377c478bd9Sstevel@tonic-gate #endif /* !defined(_XOPEN_SOURCE) */ 3387c478bd9Sstevel@tonic-gate 3397c478bd9Sstevel@tonic-gate /* Marked LEGACY in SUSv2 and removed in SUSv3 */ 3407c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 3417c478bd9Sstevel@tonic-gate extern char *cuserid(char *); 3427c478bd9Sstevel@tonic-gate extern int getopt(int, char *const *, const char *); 3437c478bd9Sstevel@tonic-gate extern char *optarg; 3447c478bd9Sstevel@tonic-gate extern int optind, opterr, optopt; 3457c478bd9Sstevel@tonic-gate extern int getw(FILE *); 3467c478bd9Sstevel@tonic-gate extern int putw(int, FILE *); 3477c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ 3487c478bd9Sstevel@tonic-gate 3497c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gate /* 3527c478bd9Sstevel@tonic-gate * The following are defined as part of the Large File Summit interfaces. 3537c478bd9Sstevel@tonic-gate */ 354*23a1cceaSRoger A. Faulkner #if defined(_LARGEFILE_SOURCE) || defined(_XPG5) 3557c478bd9Sstevel@tonic-gate extern int fseeko(FILE *, off_t, int); 3567c478bd9Sstevel@tonic-gate extern off_t ftello(FILE *); 3577c478bd9Sstevel@tonic-gate #endif 3587c478bd9Sstevel@tonic-gate 3597c478bd9Sstevel@tonic-gate /* 3607c478bd9Sstevel@tonic-gate * The following are defined as part of the transitional Large File Summit 3617c478bd9Sstevel@tonic-gate * interfaces. 3627c478bd9Sstevel@tonic-gate */ 363*23a1cceaSRoger A. Faulkner #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 3647c478bd9Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 3657c478bd9Sstevel@tonic-gate extern FILE *fopen64(const char *, const char *); 3667c478bd9Sstevel@tonic-gate extern FILE *freopen64(const char *, const char *, FILE *); 3677c478bd9Sstevel@tonic-gate extern FILE *tmpfile64(void); 3687c478bd9Sstevel@tonic-gate extern int fgetpos64(FILE *, fpos64_t *); 3697c478bd9Sstevel@tonic-gate extern int fsetpos64(FILE *, const fpos64_t *); 3707c478bd9Sstevel@tonic-gate extern int fseeko64(FILE *, off64_t, int); 3717c478bd9Sstevel@tonic-gate extern off64_t ftello64(FILE *); 3727c478bd9Sstevel@tonic-gate #endif 3737c478bd9Sstevel@tonic-gate 3747c478bd9Sstevel@tonic-gate #else /* !defined __STDC__ */ 3757c478bd9Sstevel@tonic-gate 3767c478bd9Sstevel@tonic-gate #ifndef _LP64 3777c478bd9Sstevel@tonic-gate #define _bufend(p) ((fileno(p) < _NFILE) ? _bufendtab[fileno(p)] : \ 3787c478bd9Sstevel@tonic-gate (unsigned char *)_realbufend(p)) 3797c478bd9Sstevel@tonic-gate #define _bufsiz(p) (_bufend(p) - (p)->_base) 3807c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 3817c478bd9Sstevel@tonic-gate 3827c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 3837c478bd9Sstevel@tonic-gate defined(_REENTRANT) 3847c478bd9Sstevel@tonic-gate extern char *tmpnam_r(); 3857c478bd9Sstevel@tonic-gate #endif 3867c478bd9Sstevel@tonic-gate 3877c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) 388*23a1cceaSRoger A. Faulkner extern int fcloseall(); 3897c478bd9Sstevel@tonic-gate extern void setbuffer(); 3907c478bd9Sstevel@tonic-gate extern int setlinebuf(); 391d0983205SRoger A. Faulkner extern int asprintf(); 392d0983205SRoger A. Faulkner extern int vasprintf(); 3937c478bd9Sstevel@tonic-gate #endif 3947c478bd9Sstevel@tonic-gate 395*23a1cceaSRoger A. Faulkner #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) 396*23a1cceaSRoger A. Faulkner /* || defined(_XPG7) */ 397*23a1cceaSRoger A. Faulkner extern ssize_t getdelim(); 398*23a1cceaSRoger A. Faulkner extern ssize_t getline(); 399*23a1cceaSRoger A. Faulkner #endif /* __EXTENSIONS__ ... */ 400*23a1cceaSRoger A. Faulkner 4017c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(__XOPEN_OR_POSIX) 4027c478bd9Sstevel@tonic-gate extern FILE *fdopen(); 4037c478bd9Sstevel@tonic-gate extern char *ctermid(); 4047c478bd9Sstevel@tonic-gate extern int fileno(); 4057c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(__XOPEN_OR_POSIX) */ 4067c478bd9Sstevel@tonic-gate 407*23a1cceaSRoger A. Faulkner #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ 4087c478bd9Sstevel@tonic-gate (_POSIX_C_SOURCE - 0 >= 199506L) 4097c478bd9Sstevel@tonic-gate extern void flockfile(); 4107c478bd9Sstevel@tonic-gate extern int ftrylockfile(); 4117c478bd9Sstevel@tonic-gate extern void funlockfile(); 4127c478bd9Sstevel@tonic-gate extern int getc_unlocked(); 4137c478bd9Sstevel@tonic-gate extern int getchar_unlocked(); 4147c478bd9Sstevel@tonic-gate extern int putc_unlocked(); 4157c478bd9Sstevel@tonic-gate extern int putchar_unlocked(); 4167c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ 4177c478bd9Sstevel@tonic-gate 4187c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) 4197c478bd9Sstevel@tonic-gate extern FILE *popen(); 4207c478bd9Sstevel@tonic-gate extern char *tempnam(); 4217c478bd9Sstevel@tonic-gate extern int pclose(); 4227c478bd9Sstevel@tonic-gate 4237c478bd9Sstevel@tonic-gate #if !defined(_XOPEN_SOURCE) 4247c478bd9Sstevel@tonic-gate extern int getsubopt(); 4257c478bd9Sstevel@tonic-gate #endif /* !defined(_XOPEN_SOURCE) */ 4267c478bd9Sstevel@tonic-gate 4277c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 4287c478bd9Sstevel@tonic-gate extern char *cuserid(); 4297c478bd9Sstevel@tonic-gate extern int getopt(); 4307c478bd9Sstevel@tonic-gate extern char *optarg; 4317c478bd9Sstevel@tonic-gate extern int optind, opterr, optopt; 4327c478bd9Sstevel@tonic-gate extern int getw(); 4337c478bd9Sstevel@tonic-gate extern int putw(); 4347c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ 4357c478bd9Sstevel@tonic-gate 4367c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) */ 4377c478bd9Sstevel@tonic-gate 438*23a1cceaSRoger A. Faulkner #if defined(_LARGEFILE_SOURCE) || defined(_XPG5) 4397c478bd9Sstevel@tonic-gate extern int fseeko(); 4407c478bd9Sstevel@tonic-gate extern off_t ftello(); 4417c478bd9Sstevel@tonic-gate #endif 4427c478bd9Sstevel@tonic-gate 443*23a1cceaSRoger A. Faulkner #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 4447c478bd9Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 4457c478bd9Sstevel@tonic-gate extern FILE *fopen64(); 4467c478bd9Sstevel@tonic-gate extern FILE *freopen64(); 4477c478bd9Sstevel@tonic-gate extern FILE *tmpfile64(); 4487c478bd9Sstevel@tonic-gate extern int fgetpos64(); 4497c478bd9Sstevel@tonic-gate extern int fsetpos64(); 4507c478bd9Sstevel@tonic-gate extern int fseeko64(); 4517c478bd9Sstevel@tonic-gate extern off64_t ftello64(); 4527c478bd9Sstevel@tonic-gate #endif 4537c478bd9Sstevel@tonic-gate 4547c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 4557c478bd9Sstevel@tonic-gate 4567c478bd9Sstevel@tonic-gate #if !defined(__lint) 4577c478bd9Sstevel@tonic-gate 458*23a1cceaSRoger A. Faulkner #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ 4597c478bd9Sstevel@tonic-gate (_POSIX_C_SOURCE - 0 >= 199506L) 4607c478bd9Sstevel@tonic-gate #ifndef _LP64 4617c478bd9Sstevel@tonic-gate #ifdef __STDC__ 4627c478bd9Sstevel@tonic-gate #define getc_unlocked(p) (--(p)->_cnt < 0 \ 4637c478bd9Sstevel@tonic-gate ? __filbuf(p) \ 4647c478bd9Sstevel@tonic-gate : (int)*(p)->_ptr++) 4657c478bd9Sstevel@tonic-gate #define putc_unlocked(x, p) (--(p)->_cnt < 0 \ 4667c478bd9Sstevel@tonic-gate ? __flsbuf((x), (p)) \ 4677c478bd9Sstevel@tonic-gate : (int)(*(p)->_ptr++ = \ 4687c478bd9Sstevel@tonic-gate (unsigned char) (x))) 4697c478bd9Sstevel@tonic-gate #else 4707c478bd9Sstevel@tonic-gate #define getc_unlocked(p) (--(p)->_cnt < 0 \ 4717c478bd9Sstevel@tonic-gate ? _filbuf(p) \ 4727c478bd9Sstevel@tonic-gate : (int)*(p)->_ptr++) 4737c478bd9Sstevel@tonic-gate #define putc_unlocked(x, p) (--(p)->_cnt < 0 \ 4747c478bd9Sstevel@tonic-gate ? _flsbuf((x), (p)) \ 4757c478bd9Sstevel@tonic-gate : (int)(*(p)->_ptr++ = \ 4767c478bd9Sstevel@tonic-gate (unsigned char) (x))) 4777c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 4787c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 4797c478bd9Sstevel@tonic-gate #define getchar_unlocked() getc_unlocked(stdin) 4807c478bd9Sstevel@tonic-gate #define putchar_unlocked(x) putc_unlocked((x), stdout) 4817c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ 4827c478bd9Sstevel@tonic-gate 4837c478bd9Sstevel@tonic-gate #endif /* !defined(__lint) */ 4847c478bd9Sstevel@tonic-gate 4857c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4867c478bd9Sstevel@tonic-gate } 4877c478bd9Sstevel@tonic-gate #endif 4887c478bd9Sstevel@tonic-gate 4897c478bd9Sstevel@tonic-gate #endif /* _STDIO_H */ 490