summaryrefslogtreecommitdiff
path: root/lib/libc/sys/getauxval.c
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-15 18:24:54 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-15 18:24:54 +0100
commit69e6fe89fa9baafeca3e3515bb50897cd8ee7c35 (patch)
tree489046ce167b8b20d205f87f4ae1f4b680c19b43 /lib/libc/sys/getauxval.c
parent0d5bffe9d2caadc1215c875e560c52bca5161c54 (diff)
Add getauxval and cleanup libc startup
Diffstat (limited to 'lib/libc/sys/getauxval.c')
-rw-r--r--lib/libc/sys/getauxval.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/libc/sys/getauxval.c b/lib/libc/sys/getauxval.c
new file mode 100644
index 00000000..155d4258
--- /dev/null
+++ b/lib/libc/sys/getauxval.c
@@ -0,0 +1,16 @@
+#include <errno.h>
+#include <libc.h>
+
+unsigned long getauxval(unsigned long type)
+{
+ size_t *auxv = __libc.auxv;
+
+ while (*auxv) {
+ if (*auxv == type)
+ return auxv[1];
+ auxv += 2;
+ }
+
+ errno = ENOENT;
+ return 0;
+}