[libc-commits] [PATCH] D135409: [libc] add sysconf with pagesize

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Oct 6 15:40:02 PDT 2022


sivachandra added inline comments.


================
Comment at: libc/include/llvm-libc-macros/linux/unistd-macros.h:18
 
+#define _SC_PAGESIZE 1
+
----------------
Should we equivalently define `_SC_PAGE_SIZE` also?


================
Comment at: libc/spec/posix.td:503
           RetValSpec<IntType>,
-          [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ConstCharPtr>]
         >,
----------------
Why did this get modified?


================
Comment at: libc/src/unistd/linux/sysconf.cpp:22
+  if (name == _SC_PAGESIZE) {
+    ret = EXEC_PAGESIZE;
+  }
----------------
Can we return here? Also, add a TODO here saying that we should ideally get the page size from the auxvector.


================
Comment at: libc/src/unistd/linux/sysconf.cpp:25
+  // TODO: Complete the rest of the sysconf options.
+  if (ret < 0) {
+    errno = -ret;
----------------
Can we set `errno` to `EINVAL` and return -1?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135409/new/

https://reviews.llvm.org/D135409



More information about the libc-commits mailing list