mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:17:44 +00:00
LibC+LibELF: Move getauxval and AT_* flags to sys/auxv.h
This commit is contained in:
parent
f22787dd39
commit
f12da0af13
6 changed files with 79 additions and 52 deletions
25
Userland/Libraries/LibC/sys/auxv.cpp
Normal file
25
Userland/Libraries/LibC/sys/auxv.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/auxv.h>
|
||||
#include <sys/internals.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
long getauxval(long type)
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
auxv_t* auxvp = (auxv_t*)__auxiliary_vector;
|
||||
for (; auxvp->a_type != AT_NULL; ++auxvp) {
|
||||
if (auxvp->a_type == type)
|
||||
return auxvp->a_un.a_val;
|
||||
}
|
||||
errno = ENOENT;
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue