[libc-commits] [PATCH] D135179: [libc] add CPU_COUNT macro and backing function

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Oct 4 14:01:21 PDT 2022


michaelrj added inline comments.


================
Comment at: libc/include/llvm-libc-macros/linux/sched-macros.h:13
+#define CPU_COUNT_S(setsize, set) sched_getcpucount(setsize, set)
+#define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t), set)
+
----------------
sivachandra wrote:
> These macros get activated only in the full build mode. So, do we really need a separate helper like `CPU_COUNT_S`? The internal function can be llvm libc only (as in full build only) and can take a single argument for the set?
CPU_COUNT_S is another macro that linux defines, and given that that exists it makes more sense to have one internal function that takes the same arguments and just chain the macros like this.


================
Comment at: libc/spec/gnu_ext.td:55
+            [ArgSpec<SizeTType>, ArgSpec<ConstCpuSetPtr>]
+        >,
       ]
----------------
sivachandra wrote:
> This should go into https://github.com/llvm/llvm-project/blob/main/libc/spec/llvm_libc_ext.td. Also, the function is really an internal function - it's name should have the `__` prefix.
in that case I should probably also move `__llvm_libc_syscall` into `llvm_libc_ext.td` in a followup patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135179



More information about the libc-commits mailing list