xref: /illumos-gate/usr/src/head/stdio_ext.h (revision e13f92368d64a8efb300e6217cc0931bf766e6d4)
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
5a5f69788Scraigm  * Common Development and Distribution License (the "License").
6a5f69788Scraigm  * 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  */
21a5f69788Scraigm 
227c478bd9Sstevel@tonic-gate /*
23a5f69788Scraigm  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24a5f69788Scraigm  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*
287c478bd9Sstevel@tonic-gate  * Extensions to the stdio package
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifndef _STDIO_EXT_H
327c478bd9Sstevel@tonic-gate #define	_STDIO_EXT_H
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #include <stdio.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
377c478bd9Sstevel@tonic-gate extern "C" {
387c478bd9Sstevel@tonic-gate #endif
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * Even though the contents of the stdio FILE structure have always been
427c478bd9Sstevel@tonic-gate  * private to the stdio implementation, over the years some programs have
437c478bd9Sstevel@tonic-gate  * needed to get information about a stdio stream that was not accessible
447c478bd9Sstevel@tonic-gate  * through a supported interface. These programs have resorted to accessing
457c478bd9Sstevel@tonic-gate  * fields of the FILE structure directly, rendering them possibly non-portable
467c478bd9Sstevel@tonic-gate  * to new implementations of stdio, or more likely, preventing enhancements
477c478bd9Sstevel@tonic-gate  * to stdio because those programs will break.
487c478bd9Sstevel@tonic-gate  *
497c478bd9Sstevel@tonic-gate  * In the 64-bit world, the FILE structure is opaque. The routines here
507c478bd9Sstevel@tonic-gate  * are provided as a way to get the information that used to be retrieved
517c478bd9Sstevel@tonic-gate  * directly from the FILE structure. They are based on the needs of
527c478bd9Sstevel@tonic-gate  * existing programs (such as 'mh' and 'emacs'), so they may be extended
537c478bd9Sstevel@tonic-gate  * as other programs are ported. Though they may still be non-portable to
547c478bd9Sstevel@tonic-gate  * other operating systems, they will work from each Solaris release to
557c478bd9Sstevel@tonic-gate  * the next. More portable interfaces are being developed.
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate #define	FSETLOCKING_QUERY	0
597c478bd9Sstevel@tonic-gate #define	FSETLOCKING_INTERNAL	1
607c478bd9Sstevel@tonic-gate #define	FSETLOCKING_BYCALLER	2
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate extern size_t __fbufsize(FILE *stream);
637c478bd9Sstevel@tonic-gate extern int __freading(FILE *stream);
647c478bd9Sstevel@tonic-gate extern int __fwriting(FILE *stream);
657c478bd9Sstevel@tonic-gate extern int __freadable(FILE *stream);
667c478bd9Sstevel@tonic-gate extern int __fwritable(FILE *stream);
677c478bd9Sstevel@tonic-gate extern int __flbf(FILE *stream);
687c478bd9Sstevel@tonic-gate extern void __fpurge(FILE *stream);
697c478bd9Sstevel@tonic-gate extern size_t __fpending(FILE *stream);
707c478bd9Sstevel@tonic-gate extern void _flushlbf(void);
717c478bd9Sstevel@tonic-gate extern int __fsetlocking(FILE *stream, int type);
727c478bd9Sstevel@tonic-gate 
73a5f69788Scraigm /*
74a5f69788Scraigm  * Extended FILE enabling function.
75a5f69788Scraigm  */
76a5f69788Scraigm #if defined(_LP64) && !defined(__lint)
77*31c168a2Scraigm #define	enable_extended_FILE_stdio(fd, act)		(0)
78a5f69788Scraigm #else
79a5f69788Scraigm extern int enable_extended_FILE_stdio(int, int);
80a5f69788Scraigm #endif
81a5f69788Scraigm 
827c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
837c478bd9Sstevel@tonic-gate }
847c478bd9Sstevel@tonic-gate #endif
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate #endif	/* _STDIO_EXT_H */
87