auxv.c (231868) | auxv.c (237434) |
---|---|
1/*- 2 * Copyright 2010, 2012 Konstantin Belousov <kib@FreeBSD.ORG>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright 2010, 2012 Konstantin Belousov <kib@FreeBSD.ORG>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/lib/libc/gen/aux.c 231868 2012-02-17 10:49:29Z kib $"); | 28__FBSDID("$FreeBSD: head/lib/libc/gen/aux.c 237434 2012-06-22 07:13:30Z kib $"); |
29 30#include "namespace.h" 31#include <elf.h> 32#include <errno.h> 33#include <link.h> 34#include <pthread.h> 35#include <string.h> 36#include "un-namespace.h" --- 24 unchanged lines hidden (view full) --- 61 if (&_DYNAMIC != NULL) 62 return; 63 _once(&aux_vector_once, init_aux_vector_once); 64} 65 66static pthread_once_t aux_once = PTHREAD_ONCE_INIT; 67static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; 68static char *canary, *pagesizes; | 29 30#include "namespace.h" 31#include <elf.h> 32#include <errno.h> 33#include <link.h> 34#include <pthread.h> 35#include <string.h> 36#include "un-namespace.h" --- 24 unchanged lines hidden (view full) --- 61 if (&_DYNAMIC != NULL) 62 return; 63 _once(&aux_vector_once, init_aux_vector_once); 64} 65 66static pthread_once_t aux_once = PTHREAD_ONCE_INIT; 67static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; 68static char *canary, *pagesizes; |
69static void *timekeep; |
|
69 70static void 71init_aux(void) 72{ 73 Elf_Auxinfo *aux; 74 75 for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) { 76 switch (aux->a_type) { --- 19 unchanged lines hidden (view full) --- 96 97 case AT_OSRELDATE: 98 osreldate = aux->a_un.a_val; 99 break; 100 101 case AT_NCPUS: 102 ncpus = aux->a_un.a_val; 103 break; | 70 71static void 72init_aux(void) 73{ 74 Elf_Auxinfo *aux; 75 76 for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) { 77 switch (aux->a_type) { --- 19 unchanged lines hidden (view full) --- 97 98 case AT_OSRELDATE: 99 osreldate = aux->a_un.a_val; 100 break; 101 102 case AT_NCPUS: 103 ncpus = aux->a_un.a_val; 104 break; |
105 106 case AT_TIMEKEEP: 107 timekeep = aux->a_un.a_ptr; 108 break; |
|
104 } 105 } 106} 107 108int 109_elf_aux_info(int aux, void *buf, int buflen) 110{ 111 int res; --- 46 unchanged lines hidden (view full) --- 158 if (ncpus != 0) { 159 *(int *)buf = ncpus; 160 res = 0; 161 } else 162 res = ENOENT; 163 } else 164 res = EINVAL; 165 break; | 109 } 110 } 111} 112 113int 114_elf_aux_info(int aux, void *buf, int buflen) 115{ 116 int res; --- 46 unchanged lines hidden (view full) --- 163 if (ncpus != 0) { 164 *(int *)buf = ncpus; 165 res = 0; 166 } else 167 res = ENOENT; 168 } else 169 res = EINVAL; 170 break; |
171 case AT_TIMEKEEP: 172 if (buflen == sizeof(void *)) { 173 if (timekeep != NULL) { 174 *(void **)buf = timekeep; 175 res = 0; 176 } else 177 res = ENOENT; 178 } else 179 res = EINVAL; 180 break; |
|
166 default: 167 res = ENOENT; 168 break; 169 } 170 return (res); 171} | 181 default: 182 res = ENOENT; 183 break; 184 } 185 return (res); 186} |