libprocstat: improve conditional for 32-bit compat

Include support for translating 32-bit auxv vectors on non-64-bit
platforms that aren't riscv (which has no 32-bit ABI support and
probably never will).

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42201
This commit is contained in:
Brooks Davis 2023-10-16 17:53:29 +01:00
parent 8f06fabe39
commit 248fe3d348
2 changed files with 8 additions and 3 deletions

View file

@ -2381,7 +2381,7 @@ procstat_getosrel(struct procstat *procstat, struct kinfo_proc *kp, int *osrelp)
#define PROC_AUXV_MAX 256
#if __ELF_WORD_SIZE == 64
#ifdef PS_ARCH_HAS_FREEBSD32
static const char *elf32_sv_names[] = {
"Linux ELF32",
"FreeBSD ELF32",
@ -2464,7 +2464,7 @@ procstat_getauxv32_sysctl(pid_t pid, unsigned int *cntp)
free(auxv32);
return (auxv);
}
#endif /* __ELF_WORD_SIZE == 64 */
#endif /* PS_ARCH_HAS_FREEBSD32 */
static Elf_Auxinfo *
procstat_getauxv_sysctl(pid_t pid, unsigned int *cntp)
@ -2473,7 +2473,7 @@ procstat_getauxv_sysctl(pid_t pid, unsigned int *cntp)
int name[4];
size_t len;
#if __ELF_WORD_SIZE == 64
#ifdef PS_ARCH_HAS_FREEBSD32
if (is_elf32_sysctl(pid))
return (procstat_getauxv32_sysctl(pid, cntp));
#endif

View file

@ -102,6 +102,11 @@
#define PS_FST_FFLAG_EXEC 0x2000
#define PS_FST_FFLAG_HASLOCK 0x4000
#if !defined(__ILP32__) && !defined(__riscv)
/* Target architecture supports 32-bit compat */
#define PS_ARCH_HAS_FREEBSD32 1
#endif
struct kinfo_kstack;
struct kinfo_proc;
struct kinfo_vmentry;