Use symbolic names for -C.
This commit is contained in:
parent
7d4d52d5aa
commit
1f959cb4ab
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: schedctl.8,v 1.3 2008/01/26 14:27:42 wiz Exp $
|
||||
.\" $NetBSD: schedctl.8,v 1.4 2008/04/28 16:52:17 ad Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -34,7 +34,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd January 24, 2008
|
||||
.Dd April 28, 2008
|
||||
.Dt SCHEDCTL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -66,13 +66,13 @@ A value of \-1 is used to unset the affinity.
|
|||
.It Fl C Ar class
|
||||
Scheduling class (policy) might be:
|
||||
.Bl -tag -width SCHEDOTHERXX
|
||||
.It Dv 0: SCHED_OTHER
|
||||
.It Dv SCHED_OTHER
|
||||
Time-sharing (TS) scheduling policy.
|
||||
The default policy in
|
||||
.Nx .
|
||||
.It Dv 1: SCHED_FIFO
|
||||
.It Dv SCHED_FIFO
|
||||
First in, first out (FIFO) scheduling policy.
|
||||
.It Dv 2: SCHED_RR
|
||||
.It Dv SCHED_RR
|
||||
Round-robin scheduling policy.
|
||||
.El
|
||||
.It Fl P Ar priority
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: schedctl.c,v 1.5 2008/03/24 10:33:17 xtraeme Exp $ */
|
||||
/* $NetBSD: schedctl.c,v 1.6 2008/04/28 16:52:17 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008, Mindaugas Rasiukevicius <rmind at NetBSD org>
|
||||
|
@ -33,7 +33,7 @@
|
|||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: schedctl.c,v 1.5 2008/03/24 10:33:17 xtraeme Exp $");
|
||||
__RCSID("$NetBSD: schedctl.c,v 1.6 2008/04/28 16:52:17 ad Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -53,7 +53,8 @@ __RCSID("$NetBSD: schedctl.c,v 1.5 2008/03/24 10:33:17 xtraeme Exp $");
|
|||
static const char *class_str[] = {
|
||||
"SCHED_OTHER",
|
||||
"SCHED_FIFO",
|
||||
"SCHED_RR"
|
||||
"SCHED_RR",
|
||||
NULL
|
||||
};
|
||||
|
||||
static void sched_set(pid_t, lwpid_t, int, struct sched_param *, cpuset_t *);
|
||||
|
@ -110,7 +111,12 @@ main(int argc, char **argv)
|
|||
break;
|
||||
case 'C':
|
||||
/* Scheduling class */
|
||||
policy = atoi(optarg);
|
||||
for (policy = 0; class_str[policy] != NULL; policy++) {
|
||||
if (strcasecmp(optarg, class_str[policy]) == 0)
|
||||
break;
|
||||
}
|
||||
if (class_str[policy] == NULL)
|
||||
policy = atoi(optarg);
|
||||
if (policy < SCHED_OTHER || policy > SCHED_RR) {
|
||||
fprintf(stderr,
|
||||
"%s: invalid scheduling class\n",
|
||||
|
|
Loading…
Reference in New Issue