aboutsummaryrefslogtreecommitdiff
path: root/src/misc/getauxval.c
blob: 21a8aca760cae84872a64026d9b8a0716f6d7392 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <sys/auxv.h>
#include <errno.h>
#include "libc.h"

unsigned long __getauxval(unsigned long item)
{
	size_t *auxv = libc.auxv;
	if (item == AT_SECURE) return libc.secure;
	for (; *auxv; auxv+=2)
		if (*auxv==item) return auxv[1];
	errno = ENOENT;
	return 0;
}

weak_alias(__getauxval, getauxval);


#ifdef TEST
int
main(void) {
	return 0;
}
#endif