Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/gen/auxv.c
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static pthread_once_t aux_once = PTHREAD_ONCE_INIT; | static pthread_once_t aux_once = PTHREAD_ONCE_INIT; | ||||
static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; | static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; | ||||
static int hwcap_present, hwcap2_present; | static int hwcap_present, hwcap2_present; | ||||
static char *canary, *pagesizes, *execpath; | static char *canary, *pagesizes, *execpath; | ||||
static void *timekeep; | static void *timekeep; | ||||
static u_long hwcap, hwcap2; | static u_long hwcap, hwcap2; | ||||
static void *fxrng_seed_version; | |||||
static void | static void | ||||
init_aux(void) | init_aux(void) | ||||
{ | { | ||||
Elf_Auxinfo *aux; | Elf_Auxinfo *aux; | ||||
for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) { | for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) { | ||||
switch (aux->a_type) { | switch (aux->a_type) { | ||||
Show All 37 Lines | for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) { | ||||
case AT_NCPUS: | case AT_NCPUS: | ||||
ncpus = aux->a_un.a_val; | ncpus = aux->a_un.a_val; | ||||
break; | break; | ||||
case AT_TIMEKEEP: | case AT_TIMEKEEP: | ||||
timekeep = aux->a_un.a_ptr; | timekeep = aux->a_un.a_ptr; | ||||
break; | break; | ||||
case AT_FXRNG: | |||||
fxrng_seed_version = aux->a_un.a_ptr; | |||||
break; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
__weak_reference(_elf_aux_info, elf_aux_info); | __weak_reference(_elf_aux_info, elf_aux_info); | ||||
int | int | ||||
_elf_aux_info(int aux, void *buf, int buflen) | _elf_aux_info(int aux, void *buf, int buflen) | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | if (buflen == sizeof(int)) { | ||||
res = ENOENT; | res = ENOENT; | ||||
} else | } else | ||||
res = EINVAL; | res = EINVAL; | ||||
break; | break; | ||||
case AT_TIMEKEEP: | case AT_TIMEKEEP: | ||||
if (buflen == sizeof(void *)) { | if (buflen == sizeof(void *)) { | ||||
if (timekeep != NULL) { | if (timekeep != NULL) { | ||||
*(void **)buf = timekeep; | *(void **)buf = timekeep; | ||||
res = 0; | |||||
} else | |||||
res = ENOENT; | |||||
} else | |||||
res = EINVAL; | |||||
break; | |||||
case AT_FXRNG: | |||||
if (buflen == sizeof(void *)) { | |||||
if (fxrng_seed_version != NULL) { | |||||
*(void **)buf = fxrng_seed_version; | |||||
res = 0; | res = 0; | ||||
} else | } else | ||||
res = ENOENT; | res = ENOENT; | ||||
} else | } else | ||||
res = EINVAL; | res = EINVAL; | ||||
break; | break; | ||||
default: | default: | ||||
res = ENOENT; | res = ENOENT; | ||||
break; | break; | ||||
} | } | ||||
return (res); | return (res); | ||||
} | } |