4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
31 * User-visible pieces of the ANSI C standard I/O package.
37 #include <sys/feature_tests.h>
47 #include <iso/stdio_iso.h>
50 * If feature test macros are set that enable interfaces that use types
51 * defined in <sys/types.h>, get those types by doing the include.
53 * Note that in asking for the interfaces associated with this feature test
54 * macro one also asks for definitions of the POSIX types.
58 * Allow global visibility for symbols defined in
59 * C++ "std" namespace in <iso/stdio_iso.h>.
61 #if __cplusplus >= 199711L
110 #endif /* __cplusplus >= 199711L */
113 * This header needs to be included here because it relies on the global
114 * visibility of FILE and size_t in the C++ environment.
116 #include <iso/stdio_c99.h>
127 typedef __longlong_t off_t
;
129 typedef off_t off64_t
;
133 typedef fpos_t fpos64_t
;
135 typedef __longlong_t fpos64_t
;
139 * XPG4 requires that va_list be defined in <stdio.h> "as described in
140 * <stdarg.h>". ANSI-C and POSIX require that the namespace of <stdio.h>
141 * not be polluted with this name.
143 #if defined(_XPG4) && !defined(_VA_LIST)
145 typedef __va_list
va_list;
146 #endif /* defined(_XPG4 && !defined(_VA_LIST) */
148 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
149 defined(__XOPEN_OR_POSIX)
153 /* Marked LEGACY in SUSv2 and removed in SUSv3 */
154 #if !defined(_XPG6) || defined(__EXTENSIONS__)
158 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
160 #if defined(__EXTENSIONS__) || \
161 (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
162 defined(_XOPEN_SOURCE)
164 #define P_tmpdir "/var/tmp/"
165 #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */
167 #ifndef _STDIO_ALLOCATE
168 extern unsigned char _sibuf
[], _sobuf
[];
172 extern unsigned char *_bufendtab
[];
173 extern FILE *_lastbuf
;
178 #if defined(_LP64) || defined(_I32LPx)
179 typedef long ssize_t
; /* size of something in bytes or -1 */
181 typedef int ssize_t
; /* (historical version) */
183 #endif /* !_SSIZE_T */
185 extern char *tmpnam_r(char *);
187 #if defined(__EXTENSIONS__) || \
188 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
189 extern int fcloseall(void);
190 extern void setbuffer(FILE *, char *, size_t);
191 extern int setlinebuf(FILE *);
193 extern int asprintf(char **, const char *, ...);
195 extern int vasprintf(char **, const char *, __va_list
);
198 #if defined(__EXTENSIONS__) || \
199 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
200 /* || defined(_XPG7) */
201 extern ssize_t
getdelim(char **_RESTRICT_KYWD
, size_t *_RESTRICT_KYWD
,
202 int, FILE *_RESTRICT_KYWD
);
203 extern ssize_t
getline(char **_RESTRICT_KYWD
, size_t *_RESTRICT_KYWD
,
204 FILE *_RESTRICT_KYWD
);
205 #endif /* __EXTENSIONS__ ... */
208 * The following are known to POSIX and XOPEN, but not to ANSI-C.
210 #if defined(__EXTENSIONS__) || \
211 !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX)
213 extern FILE *fdopen(int, const char *);
214 extern char *ctermid(char *);
215 extern int fileno(FILE *);
217 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
220 * The following are known to POSIX.1c, but not to ANSI-C or XOPEN.
222 extern void flockfile(FILE *);
223 extern int ftrylockfile(FILE *);
224 extern void funlockfile(FILE *);
225 extern int getc_unlocked(FILE *);
226 extern int getchar_unlocked(void);
227 extern int putc_unlocked(int, FILE *);
228 extern int putchar_unlocked(int);
231 * The following are known to XOPEN, but not to ANSI-C or POSIX.
233 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
234 defined(_XOPEN_SOURCE)
235 extern FILE *popen(const char *, const char *);
236 extern char *tempnam(const char *, const char *);
237 extern int pclose(FILE *);
238 #if !defined(_XOPEN_SOURCE)
239 extern int getsubopt(char **, char *const *, char **);
240 #endif /* !defined(_XOPEN_SOURCE) */
242 /* Marked LEGACY in SUSv2 and removed in SUSv3 */
243 #if !defined(_XPG6) || defined(__EXTENSIONS__)
244 extern char *cuserid(char *);
245 extern int getopt(int, char *const *, const char *);
247 extern int optind
, opterr
, optopt
;
248 extern int getw(FILE *);
249 extern int putw(int, FILE *);
250 #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
252 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
254 extern int fseeko(FILE *, off_t
, int);
255 extern off_t
ftello(FILE *);
257 #define getchar_unlocked() getc_unlocked(stdin)
258 #define putchar_unlocked(x) putc_unlocked((x), stdout)
264 #endif /* _STDIO_H */