[libc-commits] [libc] [libc][sched] Implement proxy headers for `cpu_set_t`, `struct sched_param` and `sched_macros`. (PR #126303)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Feb 11 14:06:47 PST 2025


================
@@ -8,19 +8,19 @@
 
 #include "src/sched/sched_getcpucount.h"
 
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/common.h"        // LLVM_LIBC_FUNCTION
+#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
 
-#include <sched.h>
-#include <stddef.h>
+#include "hdr/types/cpu_set_t.h"
+#include "hdr/types/size_t.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(int, __sched_getcpucount,
                    (size_t cpuset_size, const cpu_set_t *mask)) {
   int result = 0;
   for (size_t i = 0; i < cpuset_size / sizeof(long); ++i) {
-    result += __builtin_popcountl(mask->__mask[i]);
+    result += __builtin_popcountl(mask->__bits[i]);
----------------
nickdesaulniers wrote:

Why this change?

Also, while you're here, mind removing the `{}` in the `for`?
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/126303


More information about the libc-commits mailing list