xref: /onnv-gate/usr/src/head/stdio_ext.h (revision 1860:bb45f50305b4)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51846Scraigm  * Common Development and Distribution License (the "License").
61846Scraigm  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
211846Scraigm 
220Sstevel@tonic-gate /*
231846Scraigm  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
241846Scraigm  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate /*
280Sstevel@tonic-gate  * Extensions to the stdio package
290Sstevel@tonic-gate  */
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifndef _STDIO_EXT_H
320Sstevel@tonic-gate #define	_STDIO_EXT_H
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #include <stdio.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #ifdef	__cplusplus
390Sstevel@tonic-gate extern "C" {
400Sstevel@tonic-gate #endif
410Sstevel@tonic-gate 
420Sstevel@tonic-gate /*
430Sstevel@tonic-gate  * Even though the contents of the stdio FILE structure have always been
440Sstevel@tonic-gate  * private to the stdio implementation, over the years some programs have
450Sstevel@tonic-gate  * needed to get information about a stdio stream that was not accessible
460Sstevel@tonic-gate  * through a supported interface. These programs have resorted to accessing
470Sstevel@tonic-gate  * fields of the FILE structure directly, rendering them possibly non-portable
480Sstevel@tonic-gate  * to new implementations of stdio, or more likely, preventing enhancements
490Sstevel@tonic-gate  * to stdio because those programs will break.
500Sstevel@tonic-gate  *
510Sstevel@tonic-gate  * In the 64-bit world, the FILE structure is opaque. The routines here
520Sstevel@tonic-gate  * are provided as a way to get the information that used to be retrieved
530Sstevel@tonic-gate  * directly from the FILE structure. They are based on the needs of
540Sstevel@tonic-gate  * existing programs (such as 'mh' and 'emacs'), so they may be extended
550Sstevel@tonic-gate  * as other programs are ported. Though they may still be non-portable to
560Sstevel@tonic-gate  * other operating systems, they will work from each Solaris release to
570Sstevel@tonic-gate  * the next. More portable interfaces are being developed.
580Sstevel@tonic-gate  */
590Sstevel@tonic-gate 
600Sstevel@tonic-gate #define	FSETLOCKING_QUERY	0
610Sstevel@tonic-gate #define	FSETLOCKING_INTERNAL	1
620Sstevel@tonic-gate #define	FSETLOCKING_BYCALLER	2
630Sstevel@tonic-gate 
640Sstevel@tonic-gate extern size_t __fbufsize(FILE *stream);
650Sstevel@tonic-gate extern int __freading(FILE *stream);
660Sstevel@tonic-gate extern int __fwriting(FILE *stream);
670Sstevel@tonic-gate extern int __freadable(FILE *stream);
680Sstevel@tonic-gate extern int __fwritable(FILE *stream);
690Sstevel@tonic-gate extern int __flbf(FILE *stream);
700Sstevel@tonic-gate extern void __fpurge(FILE *stream);
710Sstevel@tonic-gate extern size_t __fpending(FILE *stream);
720Sstevel@tonic-gate extern void _flushlbf(void);
730Sstevel@tonic-gate extern int __fsetlocking(FILE *stream, int type);
740Sstevel@tonic-gate 
751846Scraigm /*
761846Scraigm  * Extended FILE enabling function.
771846Scraigm  */
781846Scraigm #if defined(_LP64) && !defined(__lint)
79*1860Scraigm #define	enable_extended_FILE_stdio(fd, act)		(0)
801846Scraigm #else
811846Scraigm extern int enable_extended_FILE_stdio(int, int);
821846Scraigm #endif
831846Scraigm 
840Sstevel@tonic-gate #ifdef	__cplusplus
850Sstevel@tonic-gate }
860Sstevel@tonic-gate #endif
870Sstevel@tonic-gate 
880Sstevel@tonic-gate #endif	/* _STDIO_EXT_H */
89