[libc-commits] [libc] [libc] use PR_GET_AUXV only if UAPI provides it (PR #162492)
Schrodinger ZHU Yifan via libc-commits
libc-commits at lists.llvm.org
Wed Oct 8 07:37:07 PDT 2025
https://github.com/SchrodingerZhu created https://github.com/llvm/llvm-project/pull/162492
None
>From 78d95e46776fc385ae9869fc9f2389ff1d3f6802 Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Wed, 8 Oct 2025 10:36:26 -0400
Subject: [PATCH] [libc] use PR_GET_AUXV only if UAPI provides it
---
libc/src/__support/OSUtil/linux/auxv.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libc/src/__support/OSUtil/linux/auxv.h b/libc/src/__support/OSUtil/linux/auxv.h
index 17108e2e54794..7fb996f01dd84 100644
--- a/libc/src/__support/OSUtil/linux/auxv.h
+++ b/libc/src/__support/OSUtil/linux/auxv.h
@@ -96,8 +96,9 @@ LIBC_INLINE void Vector::fallback_initialize_unsync() {
}
size_t avaiable_size = AUXV_MMAP_SIZE - sizeof(Entry);
- // Attempt 1: use PRCTL to get the auxv.
- // We guarantee that the vector is always padded with AT_NULL entries.
+// Attempt 1: use PRCTL to get the auxv.
+// We guarantee that the vector is always padded with AT_NULL entries.
+#ifdef PR_GET_AUXV
long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
reinterpret_cast<unsigned long>(vector),
avaiable_size, 0, 0);
@@ -105,6 +106,7 @@ LIBC_INLINE void Vector::fallback_initialize_unsync() {
entries = vector;
return;
}
+#endif
// Attempt 2: read /proc/self/auxv.
#ifdef SYS_openat
More information about the libc-commits
mailing list