Index: lib/libc/gen/auxv.c =================================================================== --- lib/libc/gen/auxv.c +++ lib/libc/gen/auxv.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include "un-namespace.h" @@ -68,7 +69,7 @@ static pthread_once_t aux_once = PTHREAD_ONCE_INIT; static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; -static int hwcap_present, hwcap2_present; +static bool hwcap_present, hwcap2_present; static char *canary, *pagesizes; static void *timekeep; static u_long hwcap, hwcap2; @@ -89,15 +90,19 @@ break; case AT_HWCAP: - hwcap_present = 1; + hwcap_present = true; hwcap = (u_long)(aux->a_un.a_val); break; case AT_HWCAP2: - hwcap2_present = 1; + hwcap2_present = true; hwcap2 = (u_long)(aux->a_un.a_val); break; + case AT_NCPUS: + ncpus = aux->a_un.a_val; + break; + case AT_PAGESIZES: pagesizes = (char *)(aux->a_un.a_ptr); break; @@ -114,10 +119,6 @@ osreldate = aux->a_un.a_val; break; - case AT_NCPUS: - ncpus = aux->a_un.a_val; - break; - case AT_TIMEKEEP: timekeep = aux->a_un.a_ptr; break; @@ -161,6 +162,16 @@ } else res = ENOENT; break; + case AT_NCPUS: + if (buflen == sizeof(int)) { + if (ncpus != 0) { + *(int *)buf = ncpus; + res = 0; + } else + res = ENOENT; + } else + res = EINVAL; + break; case AT_PAGESIZES: if (pagesizes != NULL && pagesizes_len >= buflen) { memcpy(buf, pagesizes, buflen); @@ -188,16 +199,6 @@ } else res = EINVAL; break; - case AT_NCPUS: - if (buflen == sizeof(int)) { - if (ncpus != 0) { - *(int *)buf = ncpus; - res = 0; - } else - res = ENOENT; - } else - res = EINVAL; - break; case AT_TIMEKEEP: if (buflen == sizeof(void *)) { if (timekeep != NULL) {