From 78d95e46776fc385ae9869fc9f2389ff1d3f6802 Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan 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(SYS_prctl, PR_GET_AUXV, reinterpret_cast(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