Fix files that included the posix scheduling headers that were merged earlier.
[dragonfly/vkernel-mp.git] / tools / regression / p1003_1b / prutil.c
blob948f3ced4803a355873bb3dd563ac68e149f82e4
1 #include <errno.h>
2 #include <unistd.h>
3 #include <sys/sched.h>
4 #include <stdio.h>
6 #include <err.h>
7 #include <sysexits.h>
8 #include "prutil.h"
11 * $FreeBSD: src/tools/regression/p1003_1b/prutil.c,v 1.1 2000/02/16 14:28:41 dufault Exp $
12 * $DragonFly: src/tools/regression/p1003_1b/prutil.c,v 1.3 2007/06/26 23:30:05 josepht Exp $
14 void quit(const char *text)
16 err(errno, text);
19 char *sched_text(int scheduler)
21 switch(scheduler)
23 case SCHED_FIFO:
24 return "SCHED_FIFO";
26 case SCHED_RR:
27 return "SCHED_RR";
29 case SCHED_OTHER:
30 return "SCHED_OTHER";
32 default:
33 return "Illegal scheduler value";
37 int sched_is(int line, struct sched_param *p, int shouldbe)
39 int scheduler;
40 struct sched_param param;
42 /* What scheduler are we running now?
44 errno = 0;
45 scheduler = sched_getscheduler(0);
46 if (sched_getparam(0, &param))
47 quit("sched_getparam");
49 if (p)
50 *p = param;
52 if (shouldbe != -1 && scheduler != shouldbe)
54 fprintf(stderr,
55 "At line %d the scheduler should be %s yet it is %s.\n",
56 line, sched_text(shouldbe), sched_text(scheduler));
58 exit(-1);
61 return scheduler;