On 2026-10-14 3:32 p.m., Brad Smith wrote:
On 2026-10-05 5:58 a.m., Niels Möller wrote:
Brad Smithbrad@comstyle.com writes:
elf_aux_info() returns an errno value (0 on success) rather than -1 with errno set. Ignoring the return value means the result is unreliable on failure. Treat a failure as "no features reported" so the generic code is used.
The variables are explicitly initialized to zero. I would expected that elf_aux_info leaves them unchanged on failure, i.e., they stay zero.
So I'm curious both on the conditions that might make an elf_aux_info call for AT_HWCAP or AT_HWCAP2 fail, and if it really clobbers the output buffer on failure (which seems like a rather rude api to me)?
I was specifically asked by another FreeBSD/OpenBSD developer to instate the error checking as the contract with the API does not guarantee not writing to the buffer.
I specifically made a comment along the lines you did and was told..
"That's an implementation detail, not an API guarantee."
Also I wrote the code the way I did as it mimics the behavior of getauxval().