From a032a6587011cbdac8c2f7e11f15dc4e592bbb55 Mon Sep 17 00:00:00 2001 From: Austin Foxley Date: Tue, 16 Feb 2010 12:27:18 -0800 Subject: mass sync with glibc nptl Signed-off-by: Austin Foxley --- libpthread/nptl/pthread_attr_setschedparam.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libpthread/nptl/pthread_attr_setschedparam.c') diff --git a/libpthread/nptl/pthread_attr_setschedparam.c b/libpthread/nptl/pthread_attr_setschedparam.c index 137fbe78c..741e641a6 100644 --- a/libpthread/nptl/pthread_attr_setschedparam.c +++ b/libpthread/nptl/pthread_attr_setschedparam.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2004, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -31,6 +31,12 @@ __pthread_attr_setschedparam ( assert (sizeof (*attr) >= sizeof (struct pthread_attr)); struct pthread_attr *iattr = (struct pthread_attr *) attr; + int min = sched_get_priority_min (iattr->schedpolicy); + int max = sched_get_priority_max (iattr->schedpolicy); + if (min == -1 || max == -1 + || param->sched_priority > max || param->sched_priority < min) + return EINVAL; + /* Copy the new values. */ memcpy (&iattr->schedparam, param, sizeof (struct sched_param)); -- cgit v1.2.3