From 4df5dbb5c4dc3e0068ee4b93298bd7f081caae20 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 26 Oct 2023 06:06:25 -0500 Subject: [PATCH] Cleanup: move #ifdef around the CONF block and eliminate stub list. The apple entries we stub out are scattered through the table, but this is a contiguous all-or-nothing block so just put the #ifdef around that block. --- toys/posix/getconf.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/toys/posix/getconf.c b/toys/posix/getconf.c index 05833e2a..af99d3fb 100644 --- a/toys/posix/getconf.c +++ b/toys/posix/getconf.c @@ -45,24 +45,6 @@ config GETCONF #define _SC_V7_LPBIG_OFFBIG -1 #define _CS_V7_ENV -1 #endif -// macOS and musl both don't have any of these; same argument as above. -#ifndef _SC_LEVEL1_ICACHE_SIZE -#define _SC_LEVEL1_ICACHE_SIZE -1 -#define _SC_LEVEL1_ICACHE_ASSOC -1 -#define _SC_LEVEL1_ICACHE_LINESIZE -1 -#define _SC_LEVEL1_DCACHE_SIZE -1 -#define _SC_LEVEL1_DCACHE_ASSOC -1 -#define _SC_LEVEL1_DCACHE_LINESIZE -1 -#define _SC_LEVEL2_CACHE_SIZE -1 -#define _SC_LEVEL2_CACHE_ASSOC -1 -#define _SC_LEVEL2_CACHE_LINESIZE -1 -#define _SC_LEVEL3_CACHE_SIZE -1 -#define _SC_LEVEL3_CACHE_ASSOC -1 -#define _SC_LEVEL3_CACHE_LINESIZE -1 -#define _SC_LEVEL4_CACHE_SIZE -1 -#define _SC_LEVEL4_CACHE_ASSOC -1 -#define _SC_LEVEL4_CACHE_LINESIZE -1 -#endif struct config { char *name; @@ -124,12 +106,14 @@ static struct config sysconfs[] = { CONF(TZNAME_MAX), CONF(UIO_MAXIOV), /* bionic and glibc have these; macOS and musl don't. */ +#ifndef _SC_LEVEL1_ICACHE_SIZE CONF(LEVEL1_ICACHE_SIZE), CONF(LEVEL1_ICACHE_ASSOC), CONF(LEVEL1_ICACHE_LINESIZE), CONF(LEVEL1_DCACHE_SIZE), CONF(LEVEL1_DCACHE_ASSOC), CONF(LEVEL1_DCACHE_LINESIZE), CONF(LEVEL2_CACHE_SIZE),CONF(LEVEL2_CACHE_ASSOC),CONF(LEVEL2_CACHE_LINESIZE), CONF(LEVEL3_CACHE_SIZE),CONF(LEVEL3_CACHE_ASSOC),CONF(LEVEL3_CACHE_LINESIZE), CONF(LEVEL4_CACHE_SIZE),CONF(LEVEL4_CACHE_ASSOC),CONF(LEVEL4_CACHE_LINESIZE), +#endif /* Names that just don't match the symbol, do it by hand */ {"_AVPHYS_PAGES", _SC_AVPHYS_PAGES}, {"_PHYS_PAGES", _SC_PHYS_PAGES}, -- 2.39.2