Rich Felker | 21ada94 | 2014-04-07 02:46:15 -0400 | [diff] [blame] | 1 | #include <sys/auxv.h> |
2 | #include <errno.h> | ||||
3 | #include "libc.h" | ||||
4 | |||||
5 | unsigned long getauxval(unsigned long item) | ||||
6 | { | ||||
7 | size_t *auxv = libc.auxv; | ||||
Rich Felker | 7bece9c | 2014-07-17 22:01:52 -0400 | [diff] [blame] | 8 | if (item == AT_SECURE) return libc.secure; |
Rich Felker | 21ada94 | 2014-04-07 02:46:15 -0400 | [diff] [blame] | 9 | for (; *auxv; auxv+=2) |
10 | if (*auxv==item) return auxv[1]; | ||||
11 | errno = ENOENT; | ||||
12 | return 0; | ||||
13 | } |