Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/gen/posix_spawn Don't use SCHED_OTHER.
details: https://anonhg.NetBSD.org/src/rev/4f6ec4cffbab
branches: trunk
changeset: 358233:4f6ec4cffbab
user: christos <christos%NetBSD.org@localhost>
date: Mon Dec 18 13:18:23 2017 +0000
description:
Don't use SCHED_OTHER.
diffstat:
tests/lib/libc/gen/posix_spawn/t_spawnattr.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diffs (43 lines):
diff -r 99da0a48b99e -r 4f6ec4cffbab tests/lib/libc/gen/posix_spawn/t_spawnattr.c
--- a/tests/lib/libc/gen/posix_spawn/t_spawnattr.c Mon Dec 18 12:42:21 2017 +0000
+++ b/tests/lib/libc/gen/posix_spawn/t_spawnattr.c Mon Dec 18 13:18:23 2017 +0000
@@ -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_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
Home |
Main Index |
Thread Index |
Old Index