stdio_ext.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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, see
  14. <http://www.gnu.org/licenses/>. */
  15. /* This header contains the same definitions as the header of the same name
  16. on Sun's Solaris OS. */
  17. #ifndef _STDIO_EXT_H
  18. #define _STDIO_EXT_H 1
  19. #include <stdio.h>
  20. enum
  21. {
  22. /* Query current state of the locking status. */
  23. FSETLOCKING_QUERY = 0,
  24. #define FSETLOCKING_QUERY FSETLOCKING_QUERY
  25. /* The library protects all uses of the stream functions, except for
  26. uses of the *_unlocked functions, by calls equivalent to flockfile(). */
  27. FSETLOCKING_INTERNAL,
  28. #define FSETLOCKING_INTERNAL FSETLOCKING_INTERNAL
  29. /* The user will take care of locking. */
  30. FSETLOCKING_BYCALLER
  31. #define FSETLOCKING_BYCALLER FSETLOCKING_BYCALLER
  32. };
  33. __BEGIN_DECLS
  34. /* Return the size of the buffer of FP in bytes currently in use by
  35. the given stream. */
  36. extern size_t __fbufsize (FILE *__fp) __THROW;
  37. /* Return non-zero value iff the stream FP is opened readonly, or if the
  38. last operation on the stream was a read operation. */
  39. extern int __freading (FILE *__fp) __THROW;
  40. /* Return non-zero value iff the stream FP is opened write-only or
  41. append-only, or if the last operation on the stream was a write
  42. operation. */
  43. extern int __fwriting (FILE *__fp) __THROW;
  44. /* Return non-zero value iff stream FP is not opened write-only or
  45. append-only. */
  46. extern int __freadable (FILE *__fp) __THROW;
  47. /* Return non-zero value iff stream FP is not opened read-only. */
  48. extern int __fwritable (FILE *__fp) __THROW;
  49. /* Return non-zero value iff the stream FP is line-buffered. */
  50. extern int __flbf (FILE *__fp) __THROW;
  51. /* Discard all pending buffered I/O on the stream FP. */
  52. extern void __fpurge (FILE *__fp) __THROW;
  53. /* Return amount of output in bytes pending on a stream FP. */
  54. extern size_t __fpending (FILE *__fp) __THROW;
  55. /* Flush all line-buffered files. */
  56. extern void _flushlbf (void);
  57. /* Set locking status of stream FP to TYPE. */
  58. extern int __fsetlocking (FILE *__fp, int __type) __THROW;
  59. libc_hidden_proto(__fsetlocking)
  60. __END_DECLS
  61. #endif /* stdio_ext.h */