1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */ 2 /* 3 * auxv definitions for NOLIBC 4 * Copyright (C) 2017-2021 Willy Tarreau <w@1wt.eu> 5 */ 6 7 /* make sure to include all global symbols */ 8 #include "../nolibc.h" 9 10 #ifndef _NOLIBC_SYS_AUXV_H 11 #define _NOLIBC_SYS_AUXV_H 12 13 #include "../crt.h" 14 15 static __attribute__((unused)) getauxval(unsigned long type)16unsigned long getauxval(unsigned long type) 17 { 18 const unsigned long *auxv = _auxv; 19 unsigned long ret; 20 21 if (!auxv) 22 return 0; 23 24 while (1) { 25 if (!auxv[0] && !auxv[1]) { 26 ret = 0; 27 break; 28 } 29 30 if (auxv[0] == type) { 31 ret = auxv[1]; 32 break; 33 } 34 35 auxv += 2; 36 } 37 38 return ret; 39 } 40 41 #endif /* _NOLIBC_SYS_AUXV_H */ 42