1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)stdio.h 8.5 (Berkeley) 4/29/95 |
37 * $FreeBSD: head/include/stdio.h 72529 2001-02-16 06:11:22Z imp $ |
38 */ 39 40#ifndef _STDIO_H_ 41#define _STDIO_H_ 42 43#include <sys/cdefs.h> 44#include <machine/ansi.h> 45 --- 19 unchanged lines hidden (view full) --- 65/* stdio buffers */ 66struct __sbuf { 67 unsigned char *_base; 68 int _size; 69}; 70 71struct __file_lock; 72 |
73/* hold a buncha junk that would grow the ABI */ 74struct __sFILEX { 75 struct __file_lock *_mtlock; /* used for MT-safety */ 76 unsigned char *_up; /* saved _p when _p is doing ungetc data */ 77}; 78 |
79/* 80 * stdio state variables. 81 * 82 * The following always hold: 83 * 84 * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), 85 * _lbfsize is -_bf._size, else _lbfsize is 0 86 * if _flags&__SRD, _w is 0 --- 28 unchanged lines hidden (view full) --- 115 void *_cookie; /* cookie passed to io functions */ 116 int (*_close) __P((void *)); 117 int (*_read) __P((void *, char *, int)); 118 fpos_t (*_seek) __P((void *, fpos_t, int)); 119 int (*_write) __P((void *, const char *, int)); 120 121 /* separate buffer for long sequences of ungetc() */ 122 struct __sbuf _ub; /* ungetc buffer */ |
123 struct __sFILEX *_extra; /* additions to FILE to not break ABI */ |
124 int _ur; /* saved _r when _r is counting ungetc data */ 125 126 /* tricks to meet minimum requirements even when malloc() fails */ 127 unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ 128 unsigned char _nbuf[1]; /* guarantee a getc() buffer */ 129 130 /* separate buffer for fgetln() when line crosses buffer boundary */ 131 struct __sbuf _lb; /* buffer for fgetln() */ 132 133 /* Unix stdio files get aligned to block boundaries on fseek() */ 134 int _blksize; /* stat.st_blksize (may be != _bf._size) */ 135 fpos_t _offset; /* current lseek offset (see WARNING) */ |
136} FILE; 137 138__BEGIN_DECLS |
139extern FILE __sF[]; |
140__END_DECLS 141 142#define __SLBF 0x0001 /* line buffered */ 143#define __SNBF 0x0002 /* unbuffered */ 144#define __SRD 0x0004 /* OK to read */ 145#define __SWR 0x0008 /* OK to write */ 146 /* RD and WR are never simultaneously asserted */ 147#define __SRW 0x0010 /* open for reading & writing */ --- 46 unchanged lines hidden (view full) --- 194#endif 195#ifndef SEEK_CUR 196#define SEEK_CUR 1 /* set file offset to current plus offset */ 197#endif 198#ifndef SEEK_END 199#define SEEK_END 2 /* set file offset to EOF plus offset */ 200#endif 201 |
202#define stdin (&__sF[0]) 203#define stdout (&__sF[1]) 204#define stderr (&__sF[2]) |
205 206/* 207 * Functions defined in ANSI C standard. 208 */ 209__BEGIN_DECLS 210void clearerr __P((FILE *)); 211int fclose __P((FILE *)); 212int feof __P((FILE *)); --- 196 unchanged lines hidden --- |