xref: /titanic_50/usr/src/head/stdio_ext.h (revision 10db1377dafab8ba3feedef26db9c5d8539a5cd1)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1998, by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 /*
28  * Extensions to the stdio package
29  */
30 
31 #ifndef _STDIO_EXT_H
32 #define	_STDIO_EXT_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include <stdio.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 /*
43  * Even though the contents of the stdio FILE structure have always been
44  * private to the stdio implementation, over the years some programs have
45  * needed to get information about a stdio stream that was not accessible
46  * through a supported interface. These programs have resorted to accessing
47  * fields of the FILE structure directly, rendering them possibly non-portable
48  * to new implementations of stdio, or more likely, preventing enhancements
49  * to stdio because those programs will break.
50  *
51  * In the 64-bit world, the FILE structure is opaque. The routines here
52  * are provided as a way to get the information that used to be retrieved
53  * directly from the FILE structure. They are based on the needs of
54  * existing programs (such as 'mh' and 'emacs'), so they may be extended
55  * as other programs are ported. Though they may still be non-portable to
56  * other operating systems, they will work from each Solaris release to
57  * the next. More portable interfaces are being developed.
58  */
59 
60 #define	FSETLOCKING_QUERY	0
61 #define	FSETLOCKING_INTERNAL	1
62 #define	FSETLOCKING_BYCALLER	2
63 
64 extern size_t __fbufsize(FILE *stream);
65 extern int __freading(FILE *stream);
66 extern int __fwriting(FILE *stream);
67 extern int __freadable(FILE *stream);
68 extern int __fwritable(FILE *stream);
69 extern int __flbf(FILE *stream);
70 extern void __fpurge(FILE *stream);
71 extern size_t __fpending(FILE *stream);
72 extern void _flushlbf(void);
73 extern int __fsetlocking(FILE *stream, int type);
74 
75 #ifdef	__cplusplus
76 }
77 #endif
78 
79 #endif	/* _STDIO_EXT_H */
80