[libc-commits] [libc] [libc] Add `FILENO` related macros to `unistd.h`. (PR #124688)

via libc-commits libc-commits at lists.llvm.org
Mon Jan 27 19:58:43 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: None (c8ef)

<details>
<summary>Changes</summary>

Closes #<!-- -->124637.

This is necessary to build LLVM with LLVM-libc and align the behavior with other libc implementations.
ref: https://man7.org/linux/man-pages/man3/stdin.3.html

---
Full diff: https://github.com/llvm/llvm-project/pull/124688.diff


1 Files Affected:

- (modified) libc/include/llvm-libc-macros/unistd-macros.h (+4) 


``````````diff
diff --git a/libc/include/llvm-libc-macros/unistd-macros.h b/libc/include/llvm-libc-macros/unistd-macros.h
index 4f27f075fcc61b..e09dada04a19d4 100644
--- a/libc/include/llvm-libc-macros/unistd-macros.h
+++ b/libc/include/llvm-libc-macros/unistd-macros.h
@@ -5,4 +5,8 @@
 #include "linux/unistd-macros.h"
 #endif
 
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
 #endif // LLVM_LIBC_MACROS_UNISTD_MACROS_H

``````````

</details>


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


More information about the libc-commits mailing list