about summary refs log tree commit diff
path: root/nptl/pthread_attr_setschedpolicy.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-04-22 10:28:31 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-04-22 10:28:31 +0530
commitda1304bcc8d718f40e58d92726c0fbc7b0d0794d (patch)
tree872f3f44330b1ec4faa83e22bf356ad31ef14b73 /nptl/pthread_attr_setschedpolicy.c
parent2169712d9c140d1b011470393c64258b2db3a4cd (diff)
downloadglibc-da1304bcc8d718f40e58d92726c0fbc7b0d0794d.tar.gz
glibc-da1304bcc8d718f40e58d92726c0fbc7b0d0794d.tar.xz
glibc-da1304bcc8d718f40e58d92726c0fbc7b0d0794d.zip
Consolidate pthread_attr value validation
Define inline functions that wrap around validation for each of the
pthread attributes to reduce duplication in code.
Diffstat (limited to 'nptl/pthread_attr_setschedpolicy.c')
-rw-r--r--nptl/pthread_attr_setschedpolicy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/nptl/pthread_attr_setschedpolicy.c b/nptl/pthread_attr_setschedpolicy.c
index 2fa6921690..4fe0b8e102 100644
--- a/nptl/pthread_attr_setschedpolicy.c
+++ b/nptl/pthread_attr_setschedpolicy.c
@@ -32,8 +32,9 @@ __pthread_attr_setschedpolicy (attr, policy)
   iattr = (struct pthread_attr *) attr;
 
   /* Catch invalid values.  */
-  if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR)
-    return EINVAL;
+  int ret = check_sched_policy_attr (policy);
+  if (ret)
+    return ret;
 
   /* Store the new values.  */
   iattr->schedpolicy = policy;