-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.c
36 lines (27 loc) · 834 Bytes
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/types.h>
#include "hw2_syscalls.h"
struct sched_param {
int sched_priority;
int requested_time;
int sched_short_prio;
};
int main() {
int pid = getpid();
struct sched_param sp;
sched_getparam(pid, &sp);
sp.sched_priority = 0;
sp.requested_time = 1;
sp.sched_short_prio = 1;
sched_setscheduler(pid, 5, &sp);
sleep(2);
printf("pid = %d\n", pid);
printf("is_short = %d, errno = %d\n",is_short(pid), errno);
printf("short_remaining_time = %d, errno = %d\n",short_remaining_time(pid), errno);
printf("short_place_in_queue = %d, errno = %d\n",short_place_in_queue(pid), errno);
return 0;
}