nsl_stdio_prv.h revision 004388ebfdfe2ed7dfd2d153a876dfcc22d2c006
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _NSL_STDIO_PRV_H
#define _NSL_STDIO_PRV_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* To avoid the 256 file descriptor limitation in stdio, we use our own
* private version of stdio functions. A modified FILE structure is used
* in our private stdio functions.
* To simplify, certain assumptions are made:
* - a file may be opened for either readonly or write only
* - file descriptors should not be shared between threads
* - only seek to beginning of file
* - ungetc may only work for the last char. ie., ungetc will work
* once (but not necessarily more) after a read
*/
#define __NSL_FILE_BUF_SIZE 1024
/* __NSL_FILE flags */
#define __NSL_FILE_EOF 0x01
#define __NSL_FILE_WRITE_ONLY 0x02
#define __NSL_FILE_ERR 0x04
#define __NSL_FILE_DIRTY 0x08
typedef struct {
int _nsl_file; /* integer datatype to hold */
/* file descriptor */
int _nsl_cnt; /* number of bytes available to read */
/* or write as per the access mode */
unsigned char *_nsl_ptr; /* location of next byte in buffer to */
/* read or write as per access mode */
int _nsl_flag;
unsigned char _nsl_base[__NSL_FILE_BUF_SIZE];
} __NSL_FILE;
int whence);
__NSL_FILE *stream);
#define __nsl_fileno(s) s->_nsl_file
#define __nsl_getc_unlocked(f) __nsl_fgetc(f)
#define __nsl_getc(f) __nsl_fgetc(f)
#define __nsl_rewind(f) __nsl_frewind(f)
#ifdef __cplusplus
}
#endif
#endif /* _NSL_STDIO_PRV_H */