added what_license tool
[tridge/junkcode.git] / setsched.c
1 #include <sched.h>
2 #include <unistd.h>
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <stdlib.h>
6 #include <sys/types.h>
7
8 int main(int argc, const char *argv[])
9 {
10         pid_t pid;
11         struct sched_param p;
12
13         if (argc < 2) {
14                 fprintf(stderr, "usage: setsched <pid>\n");
15                 exit(1);
16         }
17
18         p.__sched_priority = 1;
19
20         pid = atoi(argv[1]);
21         if (sched_setscheduler(pid, SCHED_FIFO, &p) == -1) {
22                 perror("sched_setscheduler");
23                 return -1;
24         }
25         return 0;
26 }