Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/gen/auxv.c
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
if (&_DYNAMIC != NULL) | if (&_DYNAMIC != NULL) | ||||
return; | return; | ||||
_once(&aux_vector_once, init_aux_vector_once); | _once(&aux_vector_once, init_aux_vector_once); | ||||
} | } | ||||
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, bsdflags; | ||||
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 | static void | ||||
init_aux(void) | init_aux(void) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 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_BSDFLAGS: | |||||
bsdflags = aux->a_un.a_val; | |||||
break; | |||||
emaste: other than `AT_OSRELDATE`/`AT_NCPUS` these seem to be in alpha order before this change | |||||
} | } | ||||
} | } | ||||
} | } | ||||
__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 80 Lines • ▼ Show 20 Lines | case AT_NCPUS: | ||||
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; | res = 0; | ||||
} else | } else | ||||
res = ENOENT; | res = ENOENT; | ||||
} else | |||||
res = EINVAL; | |||||
break; | |||||
case AT_BSDFLAGS: | |||||
if (buflen == sizeof(int)) { | |||||
*(int *)buf = bsdflags; | |||||
res = 0; | |||||
} else | } else | ||||
res = EINVAL; | res = EINVAL; | ||||
break; | break; | ||||
default: | default: | ||||
res = ENOENT; | res = ENOENT; | ||||
break; | break; | ||||
} | } | ||||
return (res); | return (res); | ||||
} | } |
other than AT_OSRELDATE/AT_NCPUS these seem to be in alpha order before this change