Update
This commit is contained in:
parent
a35c9039b4
commit
e11b6cc0b3
2 changed files with 6 additions and 1 deletions
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# getauxval-backport
|
||||||
|
|
||||||
|
Simple backport of libc's `getauxval(3)` for legacy glibc
|
|
@ -7,12 +7,14 @@ typedef Elf64_auxv_t __auxv_t;
|
||||||
typedef Elf32_auxv_t __auxv_t;
|
typedef Elf32_auxv_t __auxv_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define AUXV_FILE "/proc/self/auxv"
|
||||||
|
|
||||||
unsigned long getauxval(unsigned long type) {
|
unsigned long getauxval(unsigned long type) {
|
||||||
#ifdef GETAUXVAL_BACKPORT_DEBUG
|
#ifdef GETAUXVAL_BACKPORT_DEBUG
|
||||||
printf("getauxval: search started for type: %lu\n", type);
|
printf("getauxval: search started for type: %lu\n", type);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FILE *f = fopen("/proc/self/auxv", "rb");
|
FILE *f = fopen(AUXV_FILE, "rb");
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue