Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/lib/libc/sys Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/aeca5ab13cd4
branches:  netbsd-8
changeset: 320114:aeca5ab13cd4
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Jun 23 11:01:14 2018 +0000

description:
Pull up following revision(s) (requested by maya in ticket #892):

        lib/libc/sys/sched.c: revision 1.5

PR/52826: Onno van der Linden: Return PRI_NONE for sched_get_priority_m{in,ax}
and SCHED_OTHER.

diffstat:

 lib/libc/sys/sched.c |  22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diffs (55 lines):

diff -r f20da43986e9 -r aeca5ab13cd4 lib/libc/sys/sched.c
--- a/lib/libc/sys/sched.c      Sat Jun 23 10:52:30 2018 +0000
+++ b/lib/libc/sys/sched.c      Sat Jun 23 11:01:14 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sched.c,v 1.4 2012/03/18 02:04:39 christos Exp $       */
+/*     $NetBSD: sched.c,v 1.4.24.1 2018/06/23 11:01:14 martin Exp $    */
 
 /*
  * Copyright (c) 2008, Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: sched.c,v 1.4 2012/03/18 02:04:39 christos Exp $");
+__RCSID("$NetBSD: sched.c,v 1.4.24.1 2018/06/23 11:01:14 martin Exp $");
 
 #include <string.h>
 #include <unistd.h>
@@ -101,22 +101,32 @@
 sched_get_priority_max(int policy)
 {
 
-       if (policy < SCHED_OTHER || policy > SCHED_RR) {
+       switch (policy) {
+       case SCHED_OTHER:
+               return PRI_NONE;
+       case SCHED_RR:
+       case SCHED_FIFO:
+               return (int)sysconf(_SC_SCHED_PRI_MAX);
+       default:
                errno = EINVAL;
                return -1;
        }
-       return (int)sysconf(_SC_SCHED_PRI_MAX);
 }
 
 int
 sched_get_priority_min(int policy)
 {
 
-       if (policy < SCHED_OTHER || policy > SCHED_RR) {
+       switch (policy) {
+       case SCHED_OTHER:
+               return PRI_NONE;
+       case SCHED_RR:
+       case SCHED_FIFO:
+               return (int)sysconf(_SC_SCHED_PRI_MIN);
+       default:
                errno = EINVAL;
                return -1;
        }
-       return (int)sysconf(_SC_SCHED_PRI_MIN);
 }
 
 int



Home | Main Index | Thread Index | Old Index