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, bsdflags; | 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 *ps_strings, *timekeep; | static void *ps_strings, *timekeep; | ||||
static u_long hwcap, hwcap2; | static u_long hwcap, hwcap2; | ||||
static void *fxrng_seed_version; | |||||
#ifdef __powerpc__ | #ifdef __powerpc__ | ||||
static int powerpc_new_auxv_format = 0; | static int powerpc_new_auxv_format = 0; | ||||
static void _init_aux_powerpc_fixup(void); | static void _init_aux_powerpc_fixup(void); | ||||
int _powerpc_elf_aux_info(int, void *, int); | int _powerpc_elf_aux_info(int, void *, int); | ||||
#endif | #endif | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) { | ||||
case AT_TIMEKEEP: | case AT_TIMEKEEP: | ||||
timekeep = aux->a_un.a_ptr; | timekeep = aux->a_un.a_ptr; | ||||
break; | break; | ||||
case AT_PS_STRINGS: | case AT_PS_STRINGS: | ||||
ps_strings = aux->a_un.a_ptr; | ps_strings = aux->a_un.a_ptr; | ||||
break; | break; | ||||
case AT_FXRNG: | |||||
fxrng_seed_version = aux->a_un.a_ptr; | |||||
break; | |||||
#ifdef __powerpc__ | #ifdef __powerpc__ | ||||
/* | /* | ||||
* Since AT_STACKPROT is always set, and the common | * Since AT_STACKPROT is always set, and the common | ||||
* value 23 is mutually exclusive with the legacy powerpc | * value 23 is mutually exclusive with the legacy powerpc | ||||
* value 21, the existence of AT_STACKPROT proves we are | * value 21, the existence of AT_STACKPROT proves we are | ||||
* on the common format. | * on the common format. | ||||
*/ | */ | ||||
case AT_STACKPROT: /* 23 */ | case AT_STACKPROT: /* 23 */ | ||||
▲ Show 20 Lines • Show All 194 Lines • ▼ Show 20 Lines | if (buflen == sizeof(int)) { | ||||
res = 0; | res = 0; | ||||
} else | } else | ||||
res = EINVAL; | res = EINVAL; | ||||
break; | break; | ||||
case AT_PS_STRINGS: | case AT_PS_STRINGS: | ||||
if (buflen == sizeof(void *)) { | if (buflen == sizeof(void *)) { | ||||
if (ps_strings != NULL) { | if (ps_strings != NULL) { | ||||
*(void **)buf = ps_strings; | *(void **)buf = ps_strings; | ||||
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); | ||||
} | } |