casaroli opened a new pull request, #20532:
URL: https://github.com/apache/nuttx/pull/20532

   ## Summary
   
   glibc and musl provide `<stdio_ext.h>`, with functions that report or change 
the state of a stream. Portable code uses them instead of looking inside 
`FILE`, and fails to build on a C library without them.
   
   This adds `__fbufsize()`, `__fpending()`, `__freading()`, `__fwriting()`, 
`__freadable()`, `__fwritable()`, `__flbf()`, `__fpurge()`, `__freadahead()`, 
`__freadptr()`, `__freadptrinc()`, `__fseterr()`, `__fsetlocking()` and 
`_flushlbf()`, built on the buffer pointers of `struct file_struct`. They 
respect `CONFIG_STDIO_DISABLE_BUFFERING` and `CONFIG_NUNGET_CHARS`.
   
   ## Impact
   
   New option `CONFIG_LIBC_STDIO_EXT` (default n, depends on `FILE_STREAM`). 
Without it, nothing is built and `<stdio_ext.h>` declares nothing.
   
   ## Testing
   
   A qemu-armv8a kernel build (QEMU 11) that contains this code, with a test 
program that writes, flushes, reads back and sets the error flag of a file on 
tmpfs:
   
   ```
   __fpending: 3, __fwriting: 1, __freading: 0
   after fflush __fpending: 0
   read back: a, __freadahead: 2, __freading: 1
   __fseterr -> ferror: 1
   ```
   
   Builds: `qemu-armv8a:knsh` with and without the option.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to