1 //===-- Linux implementation of sysconf -----------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "src/unistd/sysconf.h"
11 #include "src/__support/common.h"
13 #include "hdr/unistd_macros.h"
14 #include "src/__support/macros/config.h"
15 #include "src/errno/libc_errno.h"
16 #include "src/sys/auxv/getauxval.h"
19 namespace LIBC_NAMESPACE_DECL
{
21 LLVM_LIBC_FUNCTION(long, sysconf
, (int name
)) {
23 if (name
== _SC_PAGESIZE
)
24 return static_cast<long>(getauxval(AT_PAGESZ
));
26 // TODO: Complete the rest of the sysconf options.
34 } // namespace LIBC_NAMESPACE_DECL