提交 21ada94c 编写于 作者: R Rich Felker

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.
上级 89740868
#ifndef _SYS_AUXV_H
#define _SYS_AUXV_H
#ifdef __cplusplus
extern "C" {
#endif
#include <elf.h>
unsigned long getauxval(unsigned long);
#ifdef __cplusplus
}
#endif
#endif
#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;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册