1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <errno.h> #include <libc.h> #include <stdio.h> unsigned long getauxval(unsigned long type) { size_t *p = __libc.auxv; while (*p != 0) { if (*p == type) return p[1]; p += 2; } errno = ENOENT; return 0; }