[libc-commits] [libc] [libc] fix sysconf (PR #79159)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Jan 23 08:21:51 PST 2024


================
@@ -11,16 +11,16 @@
 #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;
+    return static_cast<long>(getauxval(AT_PAGESZ));
   }
----------------
nickdesaulniers wrote:

https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

https://github.com/llvm/llvm-project/pull/79159


More information about the libc-commits mailing list