diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-04-07 02:46:15 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-04-07 02:46:15 -0400 |
commit | 21ada94c4b8c01589367cea300916d7db8461ae7 (patch) | |
tree | bdd68da89f47c8f1c002cab2cd57f1ff569c8cbc /src/misc/getauxval.c | |
parent | 89740868c9f1c84b8ee528468d12df1fa72cd392 (diff) | |
download | musl-21ada94c4b8c01589367cea300916d7db8461ae7.tar.gz musl-21ada94c4b8c01589367cea300916d7db8461ae7.tar.xz musl-21ada94c4b8c01589367cea300916d7db8461ae7.zip |
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.
Diffstat (limited to 'src/misc/getauxval.c')
-rw-r--r-- | src/misc/getauxval.c | 12 |
1 files changed, 12 insertions, 0 deletions
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 <sys/auxv.h> +#include <errno.h> +#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; +} |