void __init_elf_aux_vector(void) { if (&_DYNAMIC != NULL) return; _once(&aux_vector_once, init_aux_vector_once); }
static locale_t get_thread_locale(void) { _once(&once_control, init_key); return (fake_tls ? thread_local_locale : pthread_getspecific(locale_info_key)); }
static void set_thread_locale(locale_t loc) { _once(&once_control, init_key); if (NULL != loc) { xlocale_retain((struct xlocale_refcounted*)loc); } locale_t old = pthread_getspecific(locale_info_key); if ((NULL != old) && (loc != old)) { xlocale_release((struct xlocale_refcounted*)old); } if (fake_tls) { thread_local_locale = loc; } else { pthread_setspecific(locale_info_key, loc); } #ifndef __NO_TLS __thread_locale = loc; __set_thread_rune_locale(loc); #endif }
int _elf_aux_info(int aux, void *buf, int buflen) { int res; __init_elf_aux_vector(); if (__elf_aux_vector == NULL) return (ENOSYS); _once(&aux_once, init_aux); switch (aux) { case AT_CANARY: if (canary != NULL && canary_len >= buflen) { memcpy(buf, canary, buflen); memset(canary, 0, canary_len); canary = NULL; res = 0; } else res = ENOENT; break; case AT_PAGESIZES: if (pagesizes != NULL && pagesizes_len >= buflen) { memcpy(buf, pagesizes, buflen); res = 0; } else res = ENOENT; break; case AT_PAGESZ: if (buflen == sizeof(int)) { if (pagesize != 0) { *(int *)buf = pagesize; res = 0; } else res = ENOENT; } else res = EINVAL; break; case AT_OSRELDATE: if (buflen == sizeof(int)) { if (osreldate != 0) { *(int *)buf = osreldate; res = 0; } else res = ENOENT; } 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) { *(void **)buf = timekeep; res = 0; } else res = ENOENT; } else res = EINVAL; break; default: res = ENOENT; break; } return (res); }