xref: /illumos-gate/usr/src/head/stdio.h (revision cd62a92d)
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 /*
23ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
2423a1cceaSRoger A. Faulkner  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
27d0983205SRoger A. Faulkner /*	Copyright (c) 1988 AT&T	*/
28b4203d75SMarcel Telka /*	  All Rights Reserved	*/
29d0983205SRoger A. Faulkner 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  * User-visible pieces of the ANSI C standard I/O package.
327c478bd9Sstevel@tonic-gate  */
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifndef _STDIO_H
357c478bd9Sstevel@tonic-gate #define	_STDIO_H
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
407c478bd9Sstevel@tonic-gate extern "C" {
417c478bd9Sstevel@tonic-gate #endif
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * Do all of our 'redefine_extname' processing before
457c478bd9Sstevel@tonic-gate  * declarations of the associated functions are seen.
467c478bd9Sstevel@tonic-gate  * This is necessary to keep gcc happy.
477c478bd9Sstevel@tonic-gate  */
487c478bd9Sstevel@tonic-gate #if defined(__PRAGMA_REDEFINE_EXTNAME)
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate /* large file compilation environment setup */
517c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
527c478bd9Sstevel@tonic-gate #pragma redefine_extname	fopen		fopen64
537c478bd9Sstevel@tonic-gate #pragma redefine_extname	freopen		freopen64
547c478bd9Sstevel@tonic-gate #pragma redefine_extname	tmpfile		tmpfile64
557c478bd9Sstevel@tonic-gate #pragma redefine_extname	fgetpos		fgetpos64
567c478bd9Sstevel@tonic-gate #pragma redefine_extname	fsetpos		fsetpos64
577c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE_SOURCE)
587c478bd9Sstevel@tonic-gate #pragma redefine_extname	fseeko		fseeko64
597c478bd9Sstevel@tonic-gate #pragma redefine_extname	ftello		ftello64
607c478bd9Sstevel@tonic-gate #endif	/* _LARGEFILE_SOURCE */
617c478bd9Sstevel@tonic-gate #endif	/* !defined(_LP64) && _FILE_OFFSET_BITS == 64 */
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /* In the LP64 compilation environment, all APIs are already large file */
647c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
657c478bd9Sstevel@tonic-gate #pragma redefine_extname	fopen64		fopen
667c478bd9Sstevel@tonic-gate #pragma redefine_extname	freopen64	freopen
677c478bd9Sstevel@tonic-gate #pragma redefine_extname	tmpfile64	tmpfile
687c478bd9Sstevel@tonic-gate #pragma redefine_extname	fgetpos64	fgetpos
697c478bd9Sstevel@tonic-gate #pragma redefine_extname	fsetpos64	fsetpos
707c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE_SOURCE)
717c478bd9Sstevel@tonic-gate #pragma redefine_extname	fseeko64	fseeko
727c478bd9Sstevel@tonic-gate #pragma redefine_extname	ftello64	ftello
737c478bd9Sstevel@tonic-gate #endif	/* _LARGEFILE_SOURCE */
747c478bd9Sstevel@tonic-gate #endif	/* defined(_LP64) && defined(_LARGEFILE64_SOURCE) */
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate #endif	/* __PRAGMA_REDEFINE_EXTNAME */
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
797c478bd9Sstevel@tonic-gate }
807c478bd9Sstevel@tonic-gate #endif
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #include <iso/stdio_iso.h>
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate /*
857c478bd9Sstevel@tonic-gate  * If feature test macros are set that enable interfaces that use types
867c478bd9Sstevel@tonic-gate  * defined in <sys/types.h>, get those types by doing the include.
877c478bd9Sstevel@tonic-gate  *
887c478bd9Sstevel@tonic-gate  * Note that in asking for the interfaces associated with this feature test
897c478bd9Sstevel@tonic-gate  * macro one also asks for definitions of the POSIX types.
907c478bd9Sstevel@tonic-gate  */
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate /*
937c478bd9Sstevel@tonic-gate  * Allow global visibility for symbols defined in
947c478bd9Sstevel@tonic-gate  * C++ "std" namespace in <iso/stdio_iso.h>.
957c478bd9Sstevel@tonic-gate  */
967c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
977c478bd9Sstevel@tonic-gate using std::FILE;
987c478bd9Sstevel@tonic-gate using std::size_t;
997c478bd9Sstevel@tonic-gate using std::fpos_t;
1007c478bd9Sstevel@tonic-gate using std::remove;
1017c478bd9Sstevel@tonic-gate using std::rename;
1027c478bd9Sstevel@tonic-gate using std::tmpfile;
1037c478bd9Sstevel@tonic-gate using std::tmpnam;
1047c478bd9Sstevel@tonic-gate using std::fclose;
1057c478bd9Sstevel@tonic-gate using std::fflush;
1067c478bd9Sstevel@tonic-gate using std::fopen;
1077c478bd9Sstevel@tonic-gate using std::freopen;
1087c478bd9Sstevel@tonic-gate using std::setbuf;
1097c478bd9Sstevel@tonic-gate using std::setvbuf;
1107c478bd9Sstevel@tonic-gate using std::fprintf;
1117c478bd9Sstevel@tonic-gate using std::fscanf;
1127c478bd9Sstevel@tonic-gate using std::printf;
1137c478bd9Sstevel@tonic-gate using std::scanf;
1147c478bd9Sstevel@tonic-gate using std::sprintf;
1157c478bd9Sstevel@tonic-gate using std::sscanf;
1167c478bd9Sstevel@tonic-gate using std::vfprintf;
1177c478bd9Sstevel@tonic-gate using std::vprintf;
1187c478bd9Sstevel@tonic-gate using std::vsprintf;
1197c478bd9Sstevel@tonic-gate using std::fgetc;
1207c478bd9Sstevel@tonic-gate using std::fgets;
1217c478bd9Sstevel@tonic-gate using std::fputc;
1227c478bd9Sstevel@tonic-gate using std::fputs;
1237c478bd9Sstevel@tonic-gate using std::getc;
1247c478bd9Sstevel@tonic-gate using std::getchar;
1257c478bd9Sstevel@tonic-gate using std::gets;
1267c478bd9Sstevel@tonic-gate using std::putc;
1277c478bd9Sstevel@tonic-gate using std::putchar;
1287c478bd9Sstevel@tonic-gate using std::puts;
1297c478bd9Sstevel@tonic-gate using std::ungetc;
1307c478bd9Sstevel@tonic-gate using std::fread;
1317c478bd9Sstevel@tonic-gate using std::fwrite;
1327c478bd9Sstevel@tonic-gate using std::fgetpos;
1337c478bd9Sstevel@tonic-gate using std::fseek;
1347c478bd9Sstevel@tonic-gate using std::fsetpos;
1357c478bd9Sstevel@tonic-gate using std::ftell;
1367c478bd9Sstevel@tonic-gate using std::rewind;
1377c478bd9Sstevel@tonic-gate using std::clearerr;
1387c478bd9Sstevel@tonic-gate using std::feof;
1397c478bd9Sstevel@tonic-gate using std::ferror;
1407c478bd9Sstevel@tonic-gate using std::perror;
1417c478bd9Sstevel@tonic-gate #ifndef	_LP64
1427c478bd9Sstevel@tonic-gate using std::__filbuf;
1437c478bd9Sstevel@tonic-gate using std::__flsbuf;
1447c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
1457c478bd9Sstevel@tonic-gate #endif	/*  __cplusplus >= 199711L */
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /*
1487c478bd9Sstevel@tonic-gate  * This header needs to be included here because it relies on the global
1497c478bd9Sstevel@tonic-gate  * visibility of FILE and size_t in the C++ environment.
1507c478bd9Sstevel@tonic-gate  */
1517c478bd9Sstevel@tonic-gate #include <iso/stdio_c99.h>
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1547c478bd9Sstevel@tonic-gate extern "C" {
1557c478bd9Sstevel@tonic-gate #endif
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE_SOURCE) || defined(_XPG5)
1587c478bd9Sstevel@tonic-gate #ifndef	_OFF_T
1597c478bd9Sstevel@tonic-gate #define	_OFF_T
1607c478bd9Sstevel@tonic-gate #if defined(_LP64) || _FILE_OFFSET_BITS == 32
1617c478bd9Sstevel@tonic-gate typedef long		off_t;
1627c478bd9Sstevel@tonic-gate #else
1637c478bd9Sstevel@tonic-gate typedef __longlong_t	off_t;
1647c478bd9Sstevel@tonic-gate #endif
1657c478bd9Sstevel@tonic-gate #ifdef	_LARGEFILE64_SOURCE
1667c478bd9Sstevel@tonic-gate #ifdef _LP64
1677c478bd9Sstevel@tonic-gate typedef	off_t		off64_t;
1687c478bd9Sstevel@tonic-gate #else
1697c478bd9Sstevel@tonic-gate typedef __longlong_t	off64_t;
1707c478bd9Sstevel@tonic-gate #endif
1717c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE */
1727c478bd9Sstevel@tonic-gate #endif /* _OFF_T */
1737c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE_SOURCE */
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE64_SOURCE
1767c478bd9Sstevel@tonic-gate #ifdef _LP64
1777c478bd9Sstevel@tonic-gate typedef fpos_t		fpos64_t;
1787c478bd9Sstevel@tonic-gate #else
1797c478bd9Sstevel@tonic-gate typedef __longlong_t	fpos64_t;
1807c478bd9Sstevel@tonic-gate #endif
1817c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE */
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate /*
1847c478bd9Sstevel@tonic-gate  * XPG4 requires that va_list be defined in <stdio.h> "as described in
1857c478bd9Sstevel@tonic-gate  * <stdarg.h>".  ANSI-C and POSIX require that the namespace of <stdio.h>
1867c478bd9Sstevel@tonic-gate  * not be polluted with this name.
1877c478bd9Sstevel@tonic-gate  */
1887c478bd9Sstevel@tonic-gate #if defined(_XPG4) && !defined(_VA_LIST)
1897c478bd9Sstevel@tonic-gate #define	_VA_LIST
1907c478bd9Sstevel@tonic-gate typedef	__va_list va_list;
1917c478bd9Sstevel@tonic-gate #endif	/* defined(_XPG4 && !defined(_VA_LIST) */
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
1947c478bd9Sstevel@tonic-gate 		defined(__XOPEN_OR_POSIX)
1957c478bd9Sstevel@tonic-gate 
1967c478bd9Sstevel@tonic-gate #define	L_ctermid	9
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate /* Marked LEGACY in SUSv2 and removed in SUSv3 */
1997c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__)
2007c478bd9Sstevel@tonic-gate #define	L_cuserid	9
2017c478bd9Sstevel@tonic-gate #endif
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \
2067c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
2077c478bd9Sstevel@tonic-gate 	defined(_XOPEN_SOURCE)
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate #define	P_tmpdir	"/var/tmp/"
2107c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate #ifndef _STDIO_ALLOCATE
2137c478bd9Sstevel@tonic-gate extern unsigned char	 _sibuf[], _sobuf[];
2147c478bd9Sstevel@tonic-gate #endif
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate /* large file compilation environment setup */
2177c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
2187c478bd9Sstevel@tonic-gate #if !defined(__PRAGMA_REDEFINE_EXTNAME)
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 #define	fopen			fopen64
2257c478bd9Sstevel@tonic-gate #define	freopen			freopen64
2267c478bd9Sstevel@tonic-gate #define	tmpfile			tmpfile64
2277c478bd9Sstevel@tonic-gate #define	fgetpos			fgetpos64
2287c478bd9Sstevel@tonic-gate #define	fsetpos			fsetpos64
2297c478bd9Sstevel@tonic-gate #ifdef	_LARGEFILE_SOURCE
2307c478bd9Sstevel@tonic-gate #define	fseeko			fseeko64
2317c478bd9Sstevel@tonic-gate #define	ftello			ftello64
2327c478bd9Sstevel@tonic-gate #endif
2337c478bd9Sstevel@tonic-gate #endif	/* !__PRAGMA_REDEFINE_EXTNAME */
2347c478bd9Sstevel@tonic-gate #endif	/* !_LP64 && _FILE_OFFSET_BITS == 64 */
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate #ifndef _LP64
2377c478bd9Sstevel@tonic-gate extern unsigned char	*_bufendtab[];
2387c478bd9Sstevel@tonic-gate extern FILE		*_lastbuf;
2397c478bd9Sstevel@tonic-gate #endif
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate /* In the LP64 compilation environment, all APIs are already large file */
2427c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
2437c478bd9Sstevel@tonic-gate #if !defined(__PRAGMA_REDEFINE_EXTNAME)
2447c478bd9Sstevel@tonic-gate #define	fopen64		fopen
2457c478bd9Sstevel@tonic-gate #define	freopen64	freopen
2467c478bd9Sstevel@tonic-gate #define	tmpfile64	tmpfile
2477c478bd9Sstevel@tonic-gate #define	fgetpos64	fgetpos
2487c478bd9Sstevel@tonic-gate #define	fsetpos64	fsetpos
2497c478bd9Sstevel@tonic-gate #ifdef	_LARGEFILE_SOURCE
2507c478bd9Sstevel@tonic-gate #define	fseeko64	fseeko
2517c478bd9Sstevel@tonic-gate #define	ftello64	ftello
2527c478bd9Sstevel@tonic-gate #endif
2537c478bd9Sstevel@tonic-gate #endif	/* !__PRAGMA_REDEFINE_EXTNAME */
2547c478bd9Sstevel@tonic-gate #endif	/* _LP64 && _LARGEFILE64_SOURCE */
2557c478bd9Sstevel@tonic-gate 
25623a1cceaSRoger A. Faulkner #ifndef	_SSIZE_T
25723a1cceaSRoger A. Faulkner #define	_SSIZE_T
25823a1cceaSRoger A. Faulkner #if defined(_LP64) || defined(_I32LPx)
25923a1cceaSRoger A. Faulkner typedef long	ssize_t;	/* size of something in bytes or -1 */
26023a1cceaSRoger A. Faulkner #else
26123a1cceaSRoger A. Faulkner typedef int	ssize_t;	/* (historical version) */
26223a1cceaSRoger A. Faulkner #endif
26323a1cceaSRoger A. Faulkner #endif	/* !_SSIZE_T */
26423a1cceaSRoger A. Faulkner 
2657c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \
2667c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
2677c478bd9Sstevel@tonic-gate 	defined(_REENTRANT)
2687c478bd9Sstevel@tonic-gate extern char	*tmpnam_r(char *);
2697c478bd9Sstevel@tonic-gate #endif
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \
2727c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
27323a1cceaSRoger A. Faulkner extern int fcloseall(void);
2747c478bd9Sstevel@tonic-gate extern void setbuffer(FILE *, char *, size_t);
2757c478bd9Sstevel@tonic-gate extern int setlinebuf(FILE *);
276d0983205SRoger A. Faulkner /* PRINTFLIKE2 */
277d0983205SRoger A. Faulkner extern int asprintf(char **, const char *, ...);
278d0983205SRoger A. Faulkner /* PRINTFLIKE2 */
279d0983205SRoger A. Faulkner extern int vasprintf(char **, const char *, __va_list);
2807c478bd9Sstevel@tonic-gate #endif
2817c478bd9Sstevel@tonic-gate 
28223a1cceaSRoger A. Faulkner #if defined(__EXTENSIONS__) || \
28323a1cceaSRoger A. Faulkner 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
28423a1cceaSRoger A. Faulkner 	/* || defined(_XPG7) */
28523a1cceaSRoger A. Faulkner extern ssize_t getdelim(char **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD,
28623a1cceaSRoger A. Faulkner 	int, FILE *_RESTRICT_KYWD);
28723a1cceaSRoger A. Faulkner extern ssize_t getline(char **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD,
28823a1cceaSRoger A. Faulkner 	FILE *_RESTRICT_KYWD);
28923a1cceaSRoger A. Faulkner #endif	/* __EXTENSIONS__ ... */
29023a1cceaSRoger A. Faulkner 
2917c478bd9Sstevel@tonic-gate /*
2927c478bd9Sstevel@tonic-gate  * The following are known to POSIX and XOPEN, but not to ANSI-C.
2937c478bd9Sstevel@tonic-gate  */
2947c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \
2957c478bd9Sstevel@tonic-gate 	!defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX)
2967c478bd9Sstevel@tonic-gate 
2977c478bd9Sstevel@tonic-gate extern FILE	*fdopen(int, const char *);
2987c478bd9Sstevel@tonic-gate extern char	*ctermid(char *);
2997c478bd9Sstevel@tonic-gate extern int	fileno(FILE *);
3007c478bd9Sstevel@tonic-gate 
3017c478bd9Sstevel@tonic-gate #endif	/* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate /*
3047c478bd9Sstevel@tonic-gate  * The following are known to POSIX.1c, but not to ANSI-C or XOPEN.
3057c478bd9Sstevel@tonic-gate  */
3067c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \
3077c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE - 0 >= 199506L)
3087c478bd9Sstevel@tonic-gate extern void	flockfile(FILE *);
3097c478bd9Sstevel@tonic-gate extern int	ftrylockfile(FILE *);
3107c478bd9Sstevel@tonic-gate extern void	funlockfile(FILE *);
3117c478bd9Sstevel@tonic-gate extern int	getc_unlocked(FILE *);
3127c478bd9Sstevel@tonic-gate extern int	getchar_unlocked(void);
3137c478bd9Sstevel@tonic-gate extern int	putc_unlocked(int, FILE *);
3147c478bd9Sstevel@tonic-gate extern int	putchar_unlocked(int);
3157c478bd9Sstevel@tonic-gate 
3167c478bd9Sstevel@tonic-gate #endif	/* defined(__EXTENSIONS__) || defined(_REENTRANT).. */
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate /*
3197c478bd9Sstevel@tonic-gate  * The following are known to XOPEN, but not to ANSI-C or POSIX.
3207c478bd9Sstevel@tonic-gate  */
3217c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
3227c478bd9Sstevel@tonic-gate 	defined(_XOPEN_SOURCE)
3237c478bd9Sstevel@tonic-gate extern FILE	*popen(const char *, const char *);
3247c478bd9Sstevel@tonic-gate extern char	*tempnam(const char *, const char *);
3257c478bd9Sstevel@tonic-gate extern int	pclose(FILE *);
3267c478bd9Sstevel@tonic-gate #if !defined(_XOPEN_SOURCE)
3277c478bd9Sstevel@tonic-gate extern int	getsubopt(char **, char *const *, char **);
3287c478bd9Sstevel@tonic-gate #endif /* !defined(_XOPEN_SOURCE) */
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate /* Marked LEGACY in SUSv2 and removed in SUSv3 */
3317c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__)
3327c478bd9Sstevel@tonic-gate extern char	*cuserid(char *);
3337c478bd9Sstevel@tonic-gate extern int	getopt(int, char *const *, const char *);
3347c478bd9Sstevel@tonic-gate extern char	*optarg;
3357c478bd9Sstevel@tonic-gate extern int	optind, opterr, optopt;
3367c478bd9Sstevel@tonic-gate extern int	getw(FILE *);
3377c478bd9Sstevel@tonic-gate extern int	putw(int, FILE *);
3387c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
3397c478bd9Sstevel@tonic-gate 
3407c478bd9Sstevel@tonic-gate #endif	/* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
3417c478bd9Sstevel@tonic-gate 
3427c478bd9Sstevel@tonic-gate /*
3437c478bd9Sstevel@tonic-gate  * The following are defined as part of the Large File Summit interfaces.
3447c478bd9Sstevel@tonic-gate  */
34523a1cceaSRoger A. Faulkner #if defined(_LARGEFILE_SOURCE) || defined(_XPG5)
3467c478bd9Sstevel@tonic-gate extern int	fseeko(FILE *, off_t, int);
3477c478bd9Sstevel@tonic-gate extern off_t	ftello(FILE *);
3487c478bd9Sstevel@tonic-gate #endif
3497c478bd9Sstevel@tonic-gate 
3507c478bd9Sstevel@tonic-gate /*
3517c478bd9Sstevel@tonic-gate  * The following are defined as part of the transitional Large File Summit
3527c478bd9Sstevel@tonic-gate  * interfaces.
3537c478bd9Sstevel@tonic-gate  */
35423a1cceaSRoger A. Faulkner #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
3557c478bd9Sstevel@tonic-gate 	    !defined(__PRAGMA_REDEFINE_EXTNAME))
3567c478bd9Sstevel@tonic-gate extern FILE	*fopen64(const char *, const char *);
3577c478bd9Sstevel@tonic-gate extern FILE	*freopen64(const char *, const char *, FILE *);
3587c478bd9Sstevel@tonic-gate extern FILE	*tmpfile64(void);
3597c478bd9Sstevel@tonic-gate extern int	fgetpos64(FILE *, fpos64_t *);
3607c478bd9Sstevel@tonic-gate extern int	fsetpos64(FILE *, const fpos64_t *);
3617c478bd9Sstevel@tonic-gate extern int	fseeko64(FILE *, off64_t, int);
3627c478bd9Sstevel@tonic-gate extern off64_t	ftello64(FILE *);
3637c478bd9Sstevel@tonic-gate #endif
3647c478bd9Sstevel@tonic-gate 
365*cd62a92dSRobert Mustacchi /*
366*cd62a92dSRobert Mustacchi  * XPG7 symbols
367*cd62a92dSRobert Mustacchi  */
368*cd62a92dSRobert Mustacchi #if !defined(_STRICT_SYMBOLS) || defined(_XPG7)
369*cd62a92dSRobert Mustacchi extern FILE	*fmemopen(void *_RESTRICT_KYWD, size_t,
370*cd62a92dSRobert Mustacchi 		    const char *_RESTRICT_KYWD);
371*cd62a92dSRobert Mustacchi extern FILE	*open_memstream(char **, size_t *);
372*cd62a92dSRobert Mustacchi #endif	/* !_STRICT_SYMBOLS || _XPG7 */
373*cd62a92dSRobert Mustacchi 
37423a1cceaSRoger A. Faulkner #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \
3757c478bd9Sstevel@tonic-gate 	    (_POSIX_C_SOURCE - 0 >= 199506L)
3767c478bd9Sstevel@tonic-gate #define	getchar_unlocked()	getc_unlocked(stdin)
3777c478bd9Sstevel@tonic-gate #define	putchar_unlocked(x)	putc_unlocked((x), stdout)
3787c478bd9Sstevel@tonic-gate #endif	/* defined(__EXTENSIONS__) || defined(_REENTRANT).. */
3797c478bd9Sstevel@tonic-gate 
3807c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3817c478bd9Sstevel@tonic-gate }
3827c478bd9Sstevel@tonic-gate #endif
3837c478bd9Sstevel@tonic-gate 
3847c478bd9Sstevel@tonic-gate #endif	/* _STDIO_H */
385