[DAG] TransformFPLoadStorePair - early out if we're not loading a simple type
[llvm-project.git] / libc / src / unistd / linux / sysconf.cpp
blobf785ff321c7d7e1826c29a026ab3a4f4aa55df87
1 //===-- Linux implementation of sysconf -----------------------------------===//
2 //
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
6 //
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"
17 #include <sys/auxv.h>
19 namespace LIBC_NAMESPACE_DECL {
21 LLVM_LIBC_FUNCTION(long, sysconf, (int name)) {
22 long ret = 0;
23 if (name == _SC_PAGESIZE)
24 return static_cast<long>(getauxval(AT_PAGESZ));
26 // TODO: Complete the rest of the sysconf options.
27 if (ret < 0) {
28 libc_errno = EINVAL;
29 return -1;
31 return ret;
34 } // namespace LIBC_NAMESPACE_DECL