From 21ada94c4b8c01589367cea300916d7db8461ae7 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 7 Apr 2014 02:46:15 -0400 Subject: add getauxval function in a sense this implementation is incomplete since it doesn't provide the HWCAP_* macros for use with AT_HWCAP, which is perhaps the most important intended usage case for getauxval. they will be added at a later time. --- src/misc/getauxval.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/misc/getauxval.c (limited to 'src/misc') diff --git a/src/misc/getauxval.c b/src/misc/getauxval.c new file mode 100644 index 00000000..5ac8b3d2 --- /dev/null +++ b/src/misc/getauxval.c @@ -0,0 +1,12 @@ +#include +#include +#include "libc.h" + +unsigned long getauxval(unsigned long item) +{ + size_t *auxv = libc.auxv; + for (; *auxv; auxv+=2) + if (*auxv==item) return auxv[1]; + errno = ENOENT; + return 0; +} -- cgit v1.2.1