1*5af32e75SAxel Dörfler /* Functions to access FILE structure internals. 2*5af32e75SAxel Dörfler Copyright (C) 2000, 2001 Free Software Foundation, Inc. 3*5af32e75SAxel Dörfler This file is part of the GNU C Library. 4*5af32e75SAxel Dörfler 5*5af32e75SAxel Dörfler The GNU C Library is free software; you can redistribute it and/or 6*5af32e75SAxel Dörfler modify it under the terms of the GNU Lesser General Public 7*5af32e75SAxel Dörfler License as published by the Free Software Foundation; either 8*5af32e75SAxel Dörfler version 2.1 of the License, or (at your option) any later version. 9*5af32e75SAxel Dörfler 10*5af32e75SAxel Dörfler The GNU C Library is distributed in the hope that it will be useful, 11*5af32e75SAxel Dörfler but WITHOUT ANY WARRANTY; without even the implied warranty of 12*5af32e75SAxel Dörfler MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13*5af32e75SAxel Dörfler Lesser General Public License for more details. 14*5af32e75SAxel Dörfler 15*5af32e75SAxel Dörfler You should have received a copy of the GNU Lesser General Public 16*5af32e75SAxel Dörfler License along with the GNU C Library; if not, write to the Free 17*5af32e75SAxel Dörfler Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18*5af32e75SAxel Dörfler 02111-1307 USA. */ 19*5af32e75SAxel Dörfler 20*5af32e75SAxel Dörfler /* This header contains the same definitions as the header of the same name 21*5af32e75SAxel Dörfler on Sun's Solaris OS. */ 22*5af32e75SAxel Dörfler 23*5af32e75SAxel Dörfler #ifndef _STDIO_EXT_H 24*5af32e75SAxel Dörfler #define _STDIO_EXT_H 1 25*5af32e75SAxel Dörfler 26*5af32e75SAxel Dörfler #include <stdio.h> 27*5af32e75SAxel Dörfler 28*5af32e75SAxel Dörfler enum 29*5af32e75SAxel Dörfler { 30*5af32e75SAxel Dörfler /* Query current state of the locking status. */ 31*5af32e75SAxel Dörfler FSETLOCKING_QUERY = 0, 32*5af32e75SAxel Dörfler #define FSETLOCKING_QUERY FSETLOCKING_QUERY 33*5af32e75SAxel Dörfler /* The library protects all uses of the stream functions, except for 34*5af32e75SAxel Dörfler uses of the *_unlocked functions, by calls equivalent to flockfile(). */ 35*5af32e75SAxel Dörfler FSETLOCKING_INTERNAL, 36*5af32e75SAxel Dörfler #define FSETLOCKING_INTERNAL FSETLOCKING_INTERNAL 37*5af32e75SAxel Dörfler /* The user will take care of locking. */ 38*5af32e75SAxel Dörfler FSETLOCKING_BYCALLER 39*5af32e75SAxel Dörfler #define FSETLOCKING_BYCALLER FSETLOCKING_BYCALLER 40*5af32e75SAxel Dörfler }; 41*5af32e75SAxel Dörfler 42*5af32e75SAxel Dörfler 43*5af32e75SAxel Dörfler __BEGIN_DECLS 44*5af32e75SAxel Dörfler 45*5af32e75SAxel Dörfler /* Return the size of the buffer of FP in bytes currently in use by 46*5af32e75SAxel Dörfler the given stream. */ 47*5af32e75SAxel Dörfler extern size_t __fbufsize (FILE *__fp); 48*5af32e75SAxel Dörfler 49*5af32e75SAxel Dörfler 50*5af32e75SAxel Dörfler /* Return non-zero value iff the stream FP is opened readonly, or if the 51*5af32e75SAxel Dörfler last operation on the stream was a read operation. */ 52*5af32e75SAxel Dörfler extern int __freading (FILE *__fp); 53*5af32e75SAxel Dörfler 54*5af32e75SAxel Dörfler /* Return non-zero value iff the stream FP is opened write-only or 55*5af32e75SAxel Dörfler append-only, or if the last operation on the stream was a write 56*5af32e75SAxel Dörfler operation. */ 57*5af32e75SAxel Dörfler extern int __fwriting (FILE *__fp); 58*5af32e75SAxel Dörfler 59*5af32e75SAxel Dörfler 60*5af32e75SAxel Dörfler /* Return non-zero value iff stream FP is not opened write-only or 61*5af32e75SAxel Dörfler append-only. */ 62*5af32e75SAxel Dörfler extern int __freadable (FILE *__fp); 63*5af32e75SAxel Dörfler 64*5af32e75SAxel Dörfler /* Return non-zero value iff stream FP is not opened read-only. */ 65*5af32e75SAxel Dörfler extern int __fwritable (FILE *__fp); 66*5af32e75SAxel Dörfler 67*5af32e75SAxel Dörfler 68*5af32e75SAxel Dörfler /* Return non-zero value iff the stream FP is line-buffered. */ 69*5af32e75SAxel Dörfler extern int __flbf (FILE *__fp); 70*5af32e75SAxel Dörfler 71*5af32e75SAxel Dörfler 72*5af32e75SAxel Dörfler /* Discard all pending buffered I/O on the stream FP. */ 73*5af32e75SAxel Dörfler extern void __fpurge (FILE *__fp); 74*5af32e75SAxel Dörfler 75*5af32e75SAxel Dörfler /* Return amount of output in bytes pending on a stream FP. */ 76*5af32e75SAxel Dörfler extern size_t __fpending (FILE *__fp); 77*5af32e75SAxel Dörfler 78*5af32e75SAxel Dörfler /* Flush all line-buffered files. */ 79*5af32e75SAxel Dörfler extern void _flushlbf (void); 80*5af32e75SAxel Dörfler 81*5af32e75SAxel Dörfler 82*5af32e75SAxel Dörfler /* Set locking status of stream FP to TYPE. */ 83*5af32e75SAxel Dörfler extern int __fsetlocking (FILE *__fp, int __type); 84*5af32e75SAxel Dörfler 85*5af32e75SAxel Dörfler __END_DECLS 86*5af32e75SAxel Dörfler 87*5af32e75SAxel Dörfler #endif /* stdio_ext.h */ 88