[libc-commits] [PATCH] D149102: [libc] Fix sched_get_priority_max() syscall invocation

Tal Zussman via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Apr 24 14:55:25 PDT 2023


tzussman created this revision.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
tzussman added reviewers: michaelrj, sivachandra.
tzussman published this revision for review.

Previously used SYS_sched_get_priority_min. This also updates the tests
for SCHED_RR and SCHED_FIFO to check max_priority > min_priority, rather
than >= in order to catch future breakages.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149102

Files:
  libc/src/sched/linux/sched_get_priority_max.cpp
  libc/test/src/sched/get_priority_test.cpp


Index: libc/test/src/sched/get_priority_test.cpp
===================================================================
--- libc/test/src/sched/get_priority_test.cpp
+++ libc/test/src/sched/get_priority_test.cpp
@@ -89,7 +89,7 @@
 
     ASSERT_LE(max_priority, 99);
     ASSERT_GE(min_priority, 0);
-    ASSERT_GE(max_priority, min_priority);
+    ASSERT_GT(max_priority, min_priority);
   }
 
   {
@@ -103,6 +103,6 @@
 
     ASSERT_LE(max_priority, 99);
     ASSERT_GE(min_priority, 0);
-    ASSERT_GE(max_priority, min_priority);
+    ASSERT_GT(max_priority, min_priority);
   }
 }
Index: libc/src/sched/linux/sched_get_priority_max.cpp
===================================================================
--- libc/src/sched/linux/sched_get_priority_max.cpp
+++ libc/src/sched/linux/sched_get_priority_max.cpp
@@ -17,7 +17,7 @@
 namespace __llvm_libc {
 
 LLVM_LIBC_FUNCTION(int, sched_get_priority_max, (int policy)) {
-  long ret = __llvm_libc::syscall_impl(SYS_sched_get_priority_min, policy);
+  long ret = __llvm_libc::syscall_impl(SYS_sched_get_priority_max, policy);
   if (ret < 0) {
     libc_errno = -ret;
     return -1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149102.516543.patch
Type: text/x-patch
Size: 1130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230424/452920a0/attachment.bin>


More information about the libc-commits mailing list