[libc-commits] [libc] [libc] Support _IONBF buffering for read_unlocked (PR #120677)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Mon Jan 6 14:34:45 PST 2025


================
@@ -190,6 +190,17 @@ FileIOResult File::read_unlocked(void *data, size_t len) {
 
   prev_op = FileOp::READ;
 
+  if (bufmode == _IONBF) { // unbuffered.
+    return read_unlocked_nbf(static_cast<uint8_t *>(data), len);
+  } else if (bufmode == _IOFBF) { // fully buffered
+    return read_unlocked_fbf(static_cast<uint8_t *>(data), len);
+  } else /*if (bufmode == _IOLBF) */ { // line buffered
+    // There is no line buffered mode for read. Use fully buffer instead.
----------------
michaelrj-google wrote:

spelling nit:
```suggestion
    // There is no line buffered mode for read. Use fully buffered instead.
```

https://github.com/llvm/llvm-project/pull/120677


More information about the libc-commits mailing list