Skip to content

Commit 8c3d929

Browse files
[libc] use PR_GET_AUXV only if UAPI provides it (#162492)
1 parent ea78bfa commit 8c3d929

File tree

1 file changed

+4
-2
lines changed
  • libc/src/__support/OSUtil/linux

1 file changed

+4
-2
lines changed

libc/src/__support/OSUtil/linux/auxv.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,17 @@ LIBC_INLINE void Vector::fallback_initialize_unsync() {
9696
}
9797
size_t avaiable_size = AUXV_MMAP_SIZE - sizeof(Entry);
9898

99-
// Attempt 1: use PRCTL to get the auxv.
100-
// We guarantee that the vector is always padded with AT_NULL entries.
99+
// Attempt 1: use PRCTL to get the auxv.
100+
// We guarantee that the vector is always padded with AT_NULL entries.
101+
#ifdef PR_GET_AUXV
101102
long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
102103
reinterpret_cast<unsigned long>(vector),
103104
avaiable_size, 0, 0);
104105
if (prctl_ret >= 0) {
105106
entries = vector;
106107
return;
107108
}
109+
#endif
108110

109111
// Attempt 2: read /proc/self/auxv.
110112
#ifdef SYS_openat

0 commit comments

Comments
 (0)