stdio_ext.h 2.8 KB

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