Add SCML for scheduler-related syscalls

This commit is contained in:
Tao Su 2025-12-04 10:25:09 +00:00 committed by Tate, Hongliang Tian
parent 9783149673
commit f993073d32
4 changed files with 42 additions and 8 deletions

View File

@ -160,14 +160,14 @@ which are summarized in the table below.
| 137 | statfs | ✅ | 💯 |
| 138 | fstatfs | ✅ | 💯 |
| 139 | sysfs | ❌ | N/A |
| 140 | getpriority | ✅ | |
| 141 | setpriority | ✅ | |
| 142 | sched_setparam | ✅ | |
| 143 | sched_getparam | ✅ | |
| 144 | sched_setscheduler | ✅ | |
| 145 | sched_getscheduler | ✅ | |
| 146 | sched_get_priority_max | ✅ | |
| 147 | sched_get_priority_min | ✅ | |
| 140 | getpriority | ✅ | 💯 |
| 141 | setpriority | ✅ | 💯 |
| 142 | sched_setparam | ✅ | 💯 |
| 143 | sched_getparam | ✅ | 💯 |
| 144 | sched_setscheduler | ✅ | [⚠️](syscall-flag-coverage/process-and-thread-management/#sched_setscheduler) |
| 145 | sched_getscheduler | ✅ | 💯 |
| 146 | sched_get_priority_max | ✅ | 💯 |
| 147 | sched_get_priority_min | ✅ | 💯 |
| 148 | sched_rr_get_interval | ❌ | N/A |
| 149 | mlock | ❌ | N/A |
| 150 | munlock | ❌ | N/A |

View File

@ -52,3 +52,17 @@ Supported functionality in SCML:
For more information,
see [the man page](https://man7.org/linux/man-pages/man2/clone.2.html).
### `sched_setscheduler`
Supported functionality in SCML:
```c
{{#include sched_setscheduler.scml}}
```
Unsupported policies or flags:
* `SCHED_RESET_ON_FORK`
For more information,
see [the man page](https://man7.org/linux/man-pages/man2/sched_setscheduler.2.html).

View File

@ -79,3 +79,21 @@ setfsgid(fsgid);
// Determine CPU and NUMA node on which the calling thread is running
getcpu(cpu, node);
// Get/set program scheduling priority
getpriority(which = PRIO_PROCESS | PRIO_PGRP | PRIO_USER, who);
setpriority(which = PRIO_PROCESS | PRIO_PGRP | PRIO_USER, who, prio);
sched_policies = SCHED_FIFO | SCHED_RR | SCHED_OTHER | SCHED_BATCH |
SCHED_IDLE | SCHED_DEADLINE;
// Get static priority range
sched_get_priority_max(policy = <sched_policies>);
sched_get_priority_min(policy = <sched_policies>);
// Get/set scheduling parameters
sched_setparam(pid, param);
sched_getparam(pid, param);
// Get scheduling policy
sched_getscheduler(pid);

View File

@ -0,0 +1,2 @@
// Set scheduling policy
sched_setscheduler(pid, policy = SCHED_OTHER | SCHED_BATCH | SCHED_IDLE | SCHED_FIFO | SCHED_RR, param);