diff options
author | Alice Frosi <afrosi@redhat.com> | 2023-09-01 10:16:36 +0200 |
---|---|---|
committer | Alice Frosi <afrosi@redhat.com> | 2023-09-01 10:37:04 +0200 |
commit | 59f7f7c241253293c25e001c9340f1deeb138311 (patch) | |
tree | 4be7c160cbec552f5d5d3dcd88e85c1b98407749 /cooker/calls/scheduler.c | |
parent | aecd6adbd2f5ce12437215fe2e64e004d28db86b (diff) | |
download | seitan-59f7f7c241253293c25e001c9340f1deeb138311.tar seitan-59f7f7c241253293c25e001c9340f1deeb138311.tar.gz seitan-59f7f7c241253293c25e001c9340f1deeb138311.tar.bz2 seitan-59f7f7c241253293c25e001c9340f1deeb138311.tar.lz seitan-59f7f7c241253293c25e001c9340f1deeb138311.tar.xz seitan-59f7f7c241253293c25e001c9340f1deeb138311.tar.zst seitan-59f7f7c241253293c25e001c9340f1deeb138311.zip |
cooker, seitan: add sched_setscheduler
The sched_setscheduler requires to set the pid of the process we want to
change the priority, this adds a new metadata for getting the target pid
at runtime.
Add a couple of syscalls for the scheduler in the string parsing.
Signed-off-by: Alice Frosi <afrosi@redhat.com>
Diffstat (limited to 'cooker/calls/scheduler.c')
-rw-r--r-- | cooker/calls/scheduler.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/cooker/calls/scheduler.c b/cooker/calls/scheduler.c new file mode 100644 index 0000000..436d3c2 --- /dev/null +++ b/cooker/calls/scheduler.c @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright 2023 Red Hat GmbH + * Author: Alice Frosi <afrosi@redhat.com> + */ +#define _GNU_SOURCE +#include <sys/syscall.h> +#include <sched.h> + +#include "../cooker.h" +#include "../calls.h" + +static struct num sched_policy[] = { + { "SCHED_OTHER", SCHED_OTHER }, + { "SCHED_BATCH", SCHED_BATCH }, + { "SCHED_IDLE", SCHED_IDLE }, + { "SCHED_FIFO", SCHED_FIFO }, + { "SCHED_RR", SCHED_RR }, + { "SCHED_RESET_ON_FORK", SCHED_RESET_ON_FORK }, /* ORed in policy */ + { 0 }, +}; + +static struct field sched_param[] = { + { "sched_priority", + INT, + 0, + offsetof(struct sched_param, sched_priority), + sizeof(int), + { 0 } }, + { 0 }, +}; + +static struct arg sched_setscheduler_args[] = { + { 0, { "pid", PID, 0, 0, 0, { 0 } } }, + { 1, { "policy", INT, FLAGS, 0, 0, { .d_num = sched_policy } } }, + { 2, { "param", STRUCT, 0, 0, 0, { .d_struct = sched_param } } } +}; + +struct call syscalls_scheduler[] = { + { __NR_sched_setscheduler, "sched_setscheduler", sched_setscheduler_args }, + { 0 }, +}; |