stdio_ext.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // Copyright 2026 Aarav Ravindra Kharade
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. /* Functions to access FILE structure internals.
  17. Copyright (C) 2000-2026 Free Software Foundation, Inc.
  18. This file is part of the GNU C Library.
  19. The GNU C Library is free software; you can redistribute it and/or
  20. modify it under the terms of the GNU Lesser General Public
  21. License as published by the Free Software Foundation; either
  22. version 2.1 of the License, or (at your option) any later version.
  23. The GNU C Library is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. Lesser General Public License for more details.
  27. You should have received a copy of the GNU Lesser General Public
  28. License along with the GNU C Library; if not, see
  29. <https://www.gnu.org/licenses/>. */
  30. /* This header contains the same definitions as the header of the same name
  31. on Sun's Solaris OS. */
  32. #ifndef _STDIO_EXT_H
  33. #define _STDIO_EXT_H 1
  34. #include <stdio.h>
  35. enum
  36. {
  37. /* Query current state of the locking status. */
  38. FSETLOCKING_QUERY = 0,
  39. #define FSETLOCKING_QUERY FSETLOCKING_QUERY
  40. /* The library protects all uses of the stream functions, except for
  41. uses of the *_unlocked functions, by calls equivalent to flockfile(). */
  42. FSETLOCKING_INTERNAL,
  43. #define FSETLOCKING_INTERNAL FSETLOCKING_INTERNAL
  44. /* The user will take care of locking. */
  45. FSETLOCKING_BYCALLER
  46. #define FSETLOCKING_BYCALLER FSETLOCKING_BYCALLER
  47. };
  48. __BEGIN_DECLS
  49. /* Return the size of the buffer of FP in bytes currently in use by
  50. the given stream. */
  51. extern size_t __fbufsize (FILE *__fp) __THROW __nonnull ((1));
  52. /* Return non-zero value iff the stream FP is opened readonly, or if the
  53. last operation on the stream was a read operation. */
  54. extern int __freading (FILE *__fp) __THROW __nonnull ((1));
  55. /* Return non-zero value iff the stream FP is opened write-only or
  56. append-only, or if the last operation on the stream was a write
  57. operation. */
  58. extern int __fwriting (FILE *__fp) __THROW __nonnull ((1));
  59. /* Return non-zero value iff stream FP is not opened write-only or
  60. append-only. */
  61. extern int __freadable (FILE *__fp) __THROW __nonnull ((1));
  62. /* Return non-zero value iff stream FP is not opened read-only. */
  63. extern int __fwritable (FILE *__fp) __THROW __nonnull ((1));
  64. /* Return non-zero value iff the stream FP is line-buffered. */
  65. extern int __flbf (FILE *__fp) __THROW __nonnull ((1));
  66. /* Discard all pending buffered I/O on the stream FP. */
  67. extern void __fpurge (FILE *__fp) __THROW __nonnull ((1));
  68. /* Return amount of output in bytes pending on a stream FP. */
  69. extern size_t __fpending (FILE *__fp) __THROW __nonnull ((1));
  70. /* Flush all line-buffered files. */
  71. extern void _flushlbf (void);
  72. /* Set locking status of stream FP to TYPE. */
  73. extern int __fsetlocking (FILE *__fp, int __type) __THROW __nonnull ((1));
  74. __END_DECLS
  75. #endif /* stdio_ext.h */