[llvm] [Support] Only enable use of /proc/self/fd on Linux (PR #222497)

Brad Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 20:09:33 PDT 2026


https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/222497

Only enable the use of /proc/self/fd on OSes that provide
the compatible /proc/self/fd interface.

>From eae0921ab6e6f65e47076b314ff6b5b43f655550 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Wed, 9 Sep 2026 22:49:13 -0400
Subject: [PATCH] [Support] Only enable use of /proc/self/fd on Linux

Only enable the use of /proc/self/fd on OSes that provide
the compatible /proc/self/fd interface.
---
 llvm/lib/Support/Unix/Path.inc | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index d01967330e12f..305894444e05f 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -1027,11 +1027,7 @@ ErrorOr<basic_file_status> directory_entry::status() const {
   return s;
 }
 
-//
-// FreeBSD optionally provides /proc/self/fd, but it is incompatible with
-// Linux. The thing to use is realpath.
-//
-#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
+#if defined(__linux__)
 #define TRY_PROC_SELF_FD
 #endif
 



More information about the llvm-commits mailing list