Back to index

glibc  2.9
stdio_ext.h
Go to the documentation of this file.
00001 /* Functions to access FILE structure internals.
00002    Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 /* This header contains the same definitions as the header of the same name
00021    on Sun's Solaris OS.  */
00022 
00023 #ifndef _STDIO_EXT_H
00024 #define _STDIO_EXT_H 1
00025 
00026 #include <stdio.h>
00027 
00028 enum
00029 {
00030   /* Query current state of the locking status.  */
00031   FSETLOCKING_QUERY = 0,
00032 #define FSETLOCKING_QUERY   FSETLOCKING_QUERY
00033   /* The library protects all uses of the stream functions, except for
00034      uses of the *_unlocked functions, by calls equivalent to flockfile().  */
00035   FSETLOCKING_INTERNAL,
00036 #define FSETLOCKING_INTERNAL       FSETLOCKING_INTERNAL
00037   /* The user will take care of locking.  */
00038   FSETLOCKING_BYCALLER
00039 #define FSETLOCKING_BYCALLER       FSETLOCKING_BYCALLER
00040 };
00041 
00042 
00043 __BEGIN_DECLS
00044 
00045 /* Return the size of the buffer of FP in bytes currently in use by
00046    the given stream.  */
00047 extern size_t __fbufsize (FILE *__fp) __THROW;
00048 
00049 
00050 /* Return non-zero value iff the stream FP is opened readonly, or if the
00051    last operation on the stream was a read operation.  */
00052 extern int __freading (FILE *__fp) __THROW;
00053 
00054 /* Return non-zero value iff the stream FP is opened write-only or
00055    append-only, or if the last operation on the stream was a write
00056    operation.  */
00057 extern int __fwriting (FILE *__fp) __THROW;
00058 
00059 
00060 /* Return non-zero value iff stream FP is not opened write-only or
00061    append-only.  */
00062 extern int __freadable (FILE *__fp) __THROW;
00063 
00064 /* Return non-zero value iff stream FP is not opened read-only.  */
00065 extern int __fwritable (FILE *__fp) __THROW;
00066 
00067 
00068 /* Return non-zero value iff the stream FP is line-buffered.  */
00069 extern int __flbf (FILE *__fp) __THROW;
00070 
00071 
00072 /* Discard all pending buffered I/O on the stream FP.  */
00073 extern void __fpurge (FILE *__fp) __THROW;
00074 
00075 /* Return amount of output in bytes pending on a stream FP.  */
00076 extern size_t __fpending (FILE *__fp) __THROW;
00077 
00078 /* Flush all line-buffered files.  */
00079 extern void _flushlbf (void);
00080 
00081 
00082 /* Set locking status of stream FP to TYPE.  */
00083 extern int __fsetlocking (FILE *__fp, int __type) __THROW;
00084 
00085 __END_DECLS
00086 
00087 #endif /* stdio_ext.h */