Module Name: src
Committed By: christos
Date: Mon Dec 18 13:18:23 UTC 2017
Modified Files:
src/tests/lib/libc/gen/posix_spawn: t_spawnattr.c
Log Message:
Don't use SCHED_OTHER.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/gen/posix_spawn/t_spawnattr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libc/gen/posix_spawn/t_spawnattr.c
diff -u src/tests/lib/libc/gen/posix_spawn/t_spawnattr.c:1.1 src/tests/lib/libc/gen/posix_spawn/t_spawnattr.c:1.2
--- src/tests/lib/libc/gen/posix_spawn/t_spawnattr.c:1.1 Mon Feb 13 16:03:08 2012
+++ src/tests/lib/libc/gen/posix_spawn/t_spawnattr.c Mon Dec 18 08:18:23 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_spawnattr.c,v 1.1 2012/02/13 21:03:08 martin Exp $ */
+/* $NetBSD: t_spawnattr.c,v 1.2 2017/12/18 13:18:23 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -51,20 +51,21 @@ static int get_different_priority(void);
static int
get_different_scheduler()
{
- int scheduler, max, min, new;
-
- max = MAX(MAX(SCHED_FIFO, SCHED_OTHER), SCHED_RR);
- min = MIN(MIN(SCHED_FIFO, SCHED_OTHER), SCHED_RR);
+ /*
+ * We don't want to use SCHED_OTHER because it does not have
+ * different priorities.
+ */
/* get current schedule policy */
- scheduler = sched_getscheduler(0);
-
- /* new scheduler */
- new = (scheduler + 1);
- if (new > max)
- new = min;
-
- return new;
+ switch (sched_getscheduler(0)) {
+ case SCHED_RR:
+ return SCHED_FIFO;
+ case SCHED_FIFO:
+ case SCHED_OTHER:
+ return SCHED_RR;
+ default:
+ abort();
+ }
}
static int