xref: /titanic_52/usr/src/lib/libc/inc/file64.h (revision a5f69788de7ac07553de47f7fec8c05a9a94c105)
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
5*a5f69788Scraigm  * Common Development and Distribution License (the "License").
6*a5f69788Scraigm  * 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  */
21*a5f69788Scraigm 
227c478bd9Sstevel@tonic-gate /*
23*a5f69788Scraigm  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*
287c478bd9Sstevel@tonic-gate  * This is the header where the internal to libc definition of the FILE
297c478bd9Sstevel@tonic-gate  * structure is defined. The exrernal defintion defines the FILE structure
307c478bd9Sstevel@tonic-gate  * as an array of longs. This prevents customers from writing code that
317c478bd9Sstevel@tonic-gate  * depends upon the implemnetation of stdio. The __fbufsize(3C) man page
327c478bd9Sstevel@tonic-gate  * documents a set of routines that customers can use so that they do not
337c478bd9Sstevel@tonic-gate  * need access to the FILE structure.
347c478bd9Sstevel@tonic-gate  *
357c478bd9Sstevel@tonic-gate  * When compiling libc this file MUST be included BEFORE <stdio.h>, and
367c478bd9Sstevel@tonic-gate  * any other headers that themselves directly or indirectly include
377c478bd9Sstevel@tonic-gate  * <stdio.h>. Failure to do so, will cause the compile of libc to fail,
387c478bd9Sstevel@tonic-gate  * since the structure members will not be visible to the stdio routines.
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifndef	_FILE64_H
427c478bd9Sstevel@tonic-gate #define	_FILE64_H
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #include <synch.h>
477c478bd9Sstevel@tonic-gate #include <stdio_tag.h>
487c478bd9Sstevel@tonic-gate #include <wchar_impl.h>
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
517c478bd9Sstevel@tonic-gate extern "C" {
527c478bd9Sstevel@tonic-gate #endif
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate #ifndef	_MBSTATE_T
557c478bd9Sstevel@tonic-gate #define	_MBSTATE_T
567c478bd9Sstevel@tonic-gate typedef __mbstate_t	mbstate_t;
577c478bd9Sstevel@tonic-gate #endif
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate #define	rmutex_t	mutex_t
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate #ifdef	_LP64
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate struct __FILE_TAG {
647c478bd9Sstevel@tonic-gate 	unsigned char	*_ptr;	/* next character from/to here in buffer */
657c478bd9Sstevel@tonic-gate 	unsigned char	*_base;	/* the buffer */
667c478bd9Sstevel@tonic-gate 	unsigned char	*_end;	/* the end of the buffer */
677c478bd9Sstevel@tonic-gate 	ssize_t		_cnt;	/* number of available characters in buffer */
687c478bd9Sstevel@tonic-gate 	int		_file;	/* UNIX System file descriptor */
697c478bd9Sstevel@tonic-gate 	unsigned int	_flag;	/* the state of the stream */
707c478bd9Sstevel@tonic-gate 	rmutex_t	_lock;	/* lock for this structure */
717c478bd9Sstevel@tonic-gate 	mbstate_t	_state;	/* mbstate_t */
727c478bd9Sstevel@tonic-gate 	char		__fill[32];	/* filler to bring size to 128 bytes */
737c478bd9Sstevel@tonic-gate };
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate #else
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * Stuff missing from our 32-bit FILE struct.
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate struct xFILEdata {
817c478bd9Sstevel@tonic-gate 	uintptr_t	_magic;	/* Check: magic number, must be first */
827c478bd9Sstevel@tonic-gate 	unsigned char	*_end;	/* the end of the buffer */
837c478bd9Sstevel@tonic-gate 	rmutex_t	_lock;	/* lock for this structure */
847c478bd9Sstevel@tonic-gate 	mbstate_t	_state;	/* mbstate_t */
85*a5f69788Scraigm 	int		_altfd;	/* alternate fd if > 255 */
867c478bd9Sstevel@tonic-gate };
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate #define	XFILEINITIALIZER	{ 0, NULL, RECURSIVEMUTEX, DEFAULTMBSTATE }
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #endif	/*	_LP64	*/
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
937c478bd9Sstevel@tonic-gate }
947c478bd9Sstevel@tonic-gate #endif
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate #endif	/* _FILE64_H */
97