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