read_unlocked doesn't support _IOLBF and _IONBF modes
read_unlocked currently only supports _IOFBF buffering, this bug is to track adding support for _IOLBF and _IONBF modes. (note - write_unlocked already does have support for them).
See WIP patch in https://github.com/llvm/llvm-project/compare/main...braydonk:llvm-project:braydonk-file-buf-modes
@michaelrj-google - LMK if this can be marked as "good-first-issue"?
@llvm/issue-subscribers-libc
Author: Alexey Samsonov (vonosmas)
See WIP patch in https://github.com/llvm/llvm-project/compare/main...braydonk:llvm-project:braydonk-file-buf-modes
@michaelrj-google - LMK if this can be marked as "good-first-issue"?
Hi @michaelrj-google May I try this issue?
@jackhong12 feel free to try it, I'll assign it to you. Feel free to reach out over github or discord if you have questions.
Do we need to support _IOLBF for read_unlocked? If so, what is the behavior? It seems gnu libc doesn't support _IOLBF for fread. Could we directly apply _IOFBF buffering if the mode is _IOLBF?
I have checked the implementation of _IOLBF in https://github.com/llvm/llvm-project/compare/main...braydonk:llvm-project:braydonk-file-buf-modes, but I'm confused. If we only copy the data until the newline character \n, the data behind it might be lost.
https://github.com/braydonk/llvm-project/blob/99ecdd90e2d59554b5e021e0c8965b92e7d388d2/libc/src/__support/File/file.cpp#L299-L304