Serenity Operating System
at master 25 lines 461 B view raw
1/* 2 * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <errno.h> 8#include <sys/auxv.h> 9#include <sys/internals.h> 10 11extern "C" { 12 13long getauxval(long type) 14{ 15 errno = 0; 16 17 auxv_t* auxvp = (auxv_t*)__auxiliary_vector; 18 for (; auxvp->a_type != AT_NULL; ++auxvp) { 19 if (auxvp->a_type == type) 20 return auxvp->a_un.a_val; 21 } 22 errno = ENOENT; 23 return 0; 24} 25}