blob: 52d5a988a9494e0b564749973039a148d072741e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
//===-- Implementation file for getauxval function --------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "src/sys/auxv/getauxval.h"
#include "src/__support/OSUtil/linux/auxv.h"
#include "src/__support/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(unsigned long, getauxval, (unsigned long id)) {
if (cpp::optional<unsigned long> val = auxv::get(id))
return *val;
libc_errno = ENOENT;
return 0;
}
} // namespace LIBC_NAMESPACE_DECL
|