[Toybox] [PATCH] getconf: add cache size sysconf() queries.

Rob Landley rob at landley.net
Thu Oct 26 04:10:05 PDT 2023


On 10/25/23 18:08, enh via Toybox wrote:
> It can otherwise be quite awkward to get at this --- riscv64 puts it all
> neatly in the ELF auxv, x86-64 has it all in /proc, arm64 only exposes
> L1 instruction/data line sizes.
> 
> Annoyingly, none of musl, the BSDs, or Apple implement these sysconf()
> queries. But they're useful (and otherwise inaccessible from the command
> line) for the systems that _do_ support them.

Um, that's kind of impressively ugly. I think this is a case where I actually
would prefer the #ifdef around the block of CONF() calls, because marshalling
data to ourselves is sad and marshalling noting to ourselves is silly.

The thing about the apple defines is they're scattered around (it doesn't have
AVPHYS_PAGES but does have PHYS_PAGES right after it, the two THREAD_ROBUST
entries are punched out of a dozen contiguous thread entries it has the rest of,
and V7_ENV is all the way down in confstrs...

But this new one is a contiguous all-or-nothing block and if we're going to have
the #ifdef anyway we could just put it around the block and save we could just
#ifdef out the block instead and save 16 lines and the duplicate comment.

I moved it.

Rob


More information about the Toybox mailing list