[libc-commits] [PATCH] D126329: [libc] Add global stdout and stderr objects.

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue May 24 17:30:44 PDT 2022


abrachet added inline comments.


================
Comment at: libc/src/__support/File/linux_file.cpp:169-170
+constexpr size_t STDOUT_BUFFER_SIZE = 1024;
+char stdout_buffer[STDOUT_BUFFER_SIZE];
+LinuxFile StdOut(1, stdout_buffer, STDOUT_BUFFER_SIZE, 0, false,
+                 File::ModeFlags(File::OpenMode::APPEND));
----------------
These should probably be static


================
Comment at: libc/src/__support/File/linux_file.cpp:175
+constexpr size_t STDERR_BUFFER_SIZE = 1024;
+char stderr_buffer[STDOUT_BUFFER_SIZE];
+LinuxFile StdErr(1, stderr_buffer, STDERR_BUFFER_SIZE, 0, false,
----------------



================
Comment at: libc/src/__support/File/linux_file.cpp:176
+char stderr_buffer[STDOUT_BUFFER_SIZE];
+LinuxFile StdErr(1, stderr_buffer, STDERR_BUFFER_SIZE, 0, false,
+                 File::ModeFlags(File::OpenMode::WRITE));
----------------
I don't know what values are ok for `buffer_mode` but stderr would logically have a different buffer mode from stdout because of no line buffering.

Why does stderr have `OpenMode::WRITE` and stdout has `OpenMode::APPEND`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126329/new/

https://reviews.llvm.org/D126329



More information about the libc-commits mailing list