diff --git a/libc/src/unistd/linux/CMakeLists.txt b/libc/src/unistd/linux/CMakeLists.txt index ab9eca19e65083..42190079141b06 100644 --- a/libc/src/unistd/linux/CMakeLists.txt +++ b/libc/src/unistd/linux/CMakeLists.txt @@ -402,7 +402,9 @@ add_entrypoint_object( ../sysconf.h DEPENDS libc.include.unistd + libc.include.sys_auxv libc.src.errno.errno + libc.src.sys.auxv.getauxval ) add_entrypoint_object( diff --git a/libc/src/unistd/linux/sysconf.cpp b/libc/src/unistd/linux/sysconf.cpp index b16e15551fc788..d4577c8d3d7690 100644 --- a/libc/src/unistd/linux/sysconf.cpp +++ b/libc/src/unistd/linux/sysconf.cpp @@ -11,17 +11,17 @@ #include "src/__support/common.h" #include "src/errno/libc_errno.h" -#include // For EXEC_PAGESIZE. +#include "src/sys/auxv/getauxval.h" +#include #include namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, sysconf, (int name)) { long ret = 0; - if (name == _SC_PAGESIZE) { - // TODO: get this information from the auxvector. - return EXEC_PAGESIZE; - } + if (name == _SC_PAGESIZE) + return static_cast(getauxval(AT_PAGESZ)); + // TODO: Complete the rest of the sysconf options. if (ret < 0) { libc_errno = EINVAL;