Current Path : /usr/src/tools/regression/p1003_1b/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/src/tools/regression/p1003_1b/prutil.c |
#include <errno.h> #include <unistd.h> #include <sched.h> #include <stdio.h> #include <err.h> #include <sysexits.h> #include "prutil.h" /* * $FreeBSD: release/9.1.0/tools/regression/p1003_1b/prutil.c 57257 2000-02-16 14:28:42Z dufault $ */ void quit(const char *text) { err(errno, text); } char *sched_text(int scheduler) { switch(scheduler) { case SCHED_FIFO: return "SCHED_FIFO"; case SCHED_RR: return "SCHED_RR"; case SCHED_OTHER: return "SCHED_OTHER"; default: return "Illegal scheduler value"; } } int sched_is(int line, struct sched_param *p, int shouldbe) { int scheduler; struct sched_param param; /* What scheduler are we running now? */ errno = 0; scheduler = sched_getscheduler(0); if (sched_getparam(0, ¶m)) quit("sched_getparam"); if (p) *p = param; if (shouldbe != -1 && scheduler != shouldbe) { fprintf(stderr, "At line %d the scheduler should be %s yet it is %s.\n", line, sched_text(shouldbe), sched_text(scheduler)); exit(-1); } return scheduler; }