[libc-commits] [libc] [llvm] [libc] Use a syscall wrapper for `sched_getparam` (PR #232689)

via libc-commits libc-commits at lists.llvm.org
Fri Oct 16 04:20:38 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Connector Switch (c8ef)

<details>
<summary>Changes</summary>

This PR move `sched_getparam` behind the centralized syscall wrappers, following `libc/docs/dev/syscall_wrapper_refactor.md`.

---
Full diff: https://github.com/llvm/llvm-project/pull/232689.diff


3 Files Affected:

- (modified) libc/src/sched/linux/CMakeLists.txt (+4-3) 
- (modified) libc/src/sched/linux/sched_getparam.cpp (+4-6) 
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+15) 


``````````diff
diff --git a/libc/src/sched/linux/CMakeLists.txt b/libc/src/sched/linux/CMakeLists.txt
index ab6aaaed34103..81c29f4246917 100644
--- a/libc/src/sched/linux/CMakeLists.txt
+++ b/libc/src/sched/linux/CMakeLists.txt
@@ -122,9 +122,10 @@ add_entrypoint_object(
   DEPENDS
     libc.hdr.types.pid_t
     libc.hdr.types.struct_sched_param
-    libc.include.sys_syscall
-    libc.include.time
-    libc.src.__support.OSUtil.osutil
+    libc.src.__support.OSUtil.linux.syscall_wrappers.sched_getparam
+    libc.src.__support.common
+    libc.src.__support.libc_errno
+    libc.src.__support.macros.config
     libc.src.errno.errno
 )
 
diff --git a/libc/src/sched/linux/sched_getparam.cpp b/libc/src/sched/linux/sched_getparam.cpp
index b0576c3ac65b8..7f112177d9293 100644
--- a/libc/src/sched/linux/sched_getparam.cpp
+++ b/libc/src/sched/linux/sched_getparam.cpp
@@ -8,20 +8,18 @@
 
 #include "src/sched/sched_getparam.h"
 
-#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/OSUtil/linux/syscall_wrappers/sched_getparam.h"
 #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, sched_getparam,
                    (pid_t tid, struct sched_param *param)) {
-  int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_getparam, tid, param);
-  if (ret < 0) {
-    libc_errno = -ret;
+  auto result = linux_syscalls::sched_getparam(tid, param);
+  if (!result) {
+    libc_errno = result.error();
     return -1;
   }
   return 0;
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 781a1d1922d8e..e7de2b1569fcc 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -16973,6 +16973,21 @@ libc_function(
     ],
 )
 
+libc_function(
+    name = "sched_getparam",
+    srcs = ["src/sched/linux/sched_getparam.cpp"],
+    hdrs = ["src/sched/sched_getparam.h"],
+    deps = [
+        ":__support_common",
+        ":__support_libc_errno",
+        ":__support_macros_config",
+        ":__support_osutil_linux_syscall_wrappers_sched_getparam",
+        ":errno",
+        ":types_pid_t",
+        ":types_struct_sched_param",
+    ],
+)
+
 libc_function(
     name = "sched_getscheduler",
     srcs = ["src/sched/linux/sched_getscheduler.cpp"],

``````````

</details>


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


More information about the libc-commits mailing list