xref: /titanic_44/usr/src/head/stdio_ext.h (revision 31c168a2a91c2e8bc74cf90f132bdc2739f90043)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #include <stdio.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
397c478bd9Sstevel@tonic-gate extern "C" {
407c478bd9Sstevel@tonic-gate #endif
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * Even though the contents of the stdio FILE structure have always been
447c478bd9Sstevel@tonic-gate  * private to the stdio implementation, over the years some programs have
457c478bd9Sstevel@tonic-gate  * needed to get information about a stdio stream that was not accessible
467c478bd9Sstevel@tonic-gate  * through a supported interface. These programs have resorted to accessing
477c478bd9Sstevel@tonic-gate  * fields of the FILE structure directly, rendering them possibly non-portable
487c478bd9Sstevel@tonic-gate  * to new implementations of stdio, or more likely, preventing enhancements
497c478bd9Sstevel@tonic-gate  * to stdio because those programs will break.
507c478bd9Sstevel@tonic-gate  *
517c478bd9Sstevel@tonic-gate  * In the 64-bit world, the FILE structure is opaque. The routines here
527c478bd9Sstevel@tonic-gate  * are provided as a way to get the information that used to be retrieved
537c478bd9Sstevel@tonic-gate  * directly from the FILE structure. They are based on the needs of
547c478bd9Sstevel@tonic-gate  * existing programs (such as 'mh' and 'emacs'), so they may be extended
557c478bd9Sstevel@tonic-gate  * as other programs are ported. Though they may still be non-portable to
567c478bd9Sstevel@tonic-gate  * other operating systems, they will work from each Solaris release to
577c478bd9Sstevel@tonic-gate  * the next. More portable interfaces are being developed.
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate #define	FSETLOCKING_QUERY	0
617c478bd9Sstevel@tonic-gate #define	FSETLOCKING_INTERNAL	1
627c478bd9Sstevel@tonic-gate #define	FSETLOCKING_BYCALLER	2
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate extern size_t __fbufsize(FILE *stream);
657c478bd9Sstevel@tonic-gate extern int __freading(FILE *stream);
667c478bd9Sstevel@tonic-gate extern int __fwriting(FILE *stream);
677c478bd9Sstevel@tonic-gate extern int __freadable(FILE *stream);
687c478bd9Sstevel@tonic-gate extern int __fwritable(FILE *stream);
697c478bd9Sstevel@tonic-gate extern int __flbf(FILE *stream);
707c478bd9Sstevel@tonic-gate extern void __fpurge(FILE *stream);
717c478bd9Sstevel@tonic-gate extern size_t __fpending(FILE *stream);
727c478bd9Sstevel@tonic-gate extern void _flushlbf(void);
737c478bd9Sstevel@tonic-gate extern int __fsetlocking(FILE *stream, int type);
747c478bd9Sstevel@tonic-gate 
75a5f69788Scraigm /*
76a5f69788Scraigm  * Extended FILE enabling function.
77a5f69788Scraigm  */
78a5f69788Scraigm #if defined(_LP64) && !defined(__lint)
79*31c168a2Scraigm #define	enable_extended_FILE_stdio(fd, act)		(0)
80a5f69788Scraigm #else
81a5f69788Scraigm extern int enable_extended_FILE_stdio(int, int);
82a5f69788Scraigm #endif
83a5f69788Scraigm 
847c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
857c478bd9Sstevel@tonic-gate }
867c478bd9Sstevel@tonic-gate #endif
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate #endif	/* _STDIO_EXT_H */
89