[libc-commits] [libc] [libc] Add implementation of getcpu syscall wrapper (PR #150871)

Aiden Grossman via libc-commits libc-commits at lists.llvm.org
Wed Jul 30 09:16:27 PDT 2025


================
@@ -0,0 +1,29 @@
+//===-- Implementation of getcpu ------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/sched/getcpu.h"
+
+#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
+#include "src/__support/macros/config.h"
+
+#include <sys/syscall.h> // For syscall numbers.
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(int, getcpu, (unsigned int *cpu, unsigned int *node)) {
+  int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_getcpu, cpu, node);
----------------
boomanaiden154 wrote:

Ah, yep. Looks like it's helpful to actually read the whole thing...

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


More information about the libc-commits mailing list