[PATCH] D159168: [Support] Implement getMainExecutable for OpenBSD
Brad Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 1 16:48:07 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG69d79f1f7714: [Support] Implement getMainExecutable for OpenBSD (authored by brad).
Changed prior to commit:
https://reviews.llvm.org/D159168?vs=554576&id=555533#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159168/new/
https://reviews.llvm.org/D159168
Files:
llvm/lib/Support/Unix/Path.inc
Index: llvm/lib/Support/Unix/Path.inc
===================================================================
--- llvm/lib/Support/Unix/Path.inc
+++ llvm/lib/Support/Unix/Path.inc
@@ -233,8 +233,8 @@
// Fall back to argv[0] if auxiliary vectors are not available.
if (getprogpath(exe_path, argv0) != NULL)
return exe_path;
-#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || \
- defined(__FreeBSD_kernel__) || defined(_AIX)
+#elif defined(_AIX) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) || \
+ defined(__NetBSD__)
const char *curproc = "/proc/curproc/file";
char exe_path[PATH_MAX];
if (sys::fs::exists(curproc)) {
@@ -283,6 +283,11 @@
// Fall back to the classical detection.
if (getprogpath(exe_path, argv0))
return exe_path;
+#elif defined(__OpenBSD__)
+ char exe_path[PATH_MAX];
+ // argv[0] only
+ if (getprogpath(exe_path, argv0) != NULL)
+ return exe_path;
#elif defined(__sun__) && defined(__svr4__)
char exe_path[PATH_MAX];
const char *aPath = "/proc/self/execname";
@@ -951,7 +956,7 @@
// FreeBSD optionally provides /proc/self/fd, but it is incompatible with
// Linux. The thing to use is realpath.
//
-#if !defined(__FreeBSD__)
+#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
#define TRY_PROC_SELF_FD
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159168.555533.patch
Type: text/x-patch
Size: 1320 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230901/97c9b0ad/attachment.bin>
More information about the llvm-commits
mailing list