Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libc/src/unistd/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 5 additions & 5 deletions libc/src/unistd/linux/sysconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
#include "src/__support/common.h"

#include "src/errno/libc_errno.h"
#include <linux/param.h> // For EXEC_PAGESIZE.
#include "src/sys/auxv/getauxval.h"
#include <sys/auxv.h>
#include <unistd.h>

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<long>(getauxval(AT_PAGESZ));

// TODO: Complete the rest of the sysconf options.
if (ret < 0) {
libc_errno = EINVAL;
Expand Down