diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2013-04-22 10:28:31 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2013-04-22 10:28:31 +0530 |
commit | da1304bcc8d718f40e58d92726c0fbc7b0d0794d (patch) | |
tree | 872f3f44330b1ec4faa83e22bf356ad31ef14b73 /nptl/sysdeps/unix | |
parent | 2169712d9c140d1b011470393c64258b2db3a4cd (diff) | |
download | glibc-da1304bcc8d718f40e58d92726c0fbc7b0d0794d.tar.gz |
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/sysdeps/unix')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c b/nptl/sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c index 8b7a499f86..b4335c56e3 100644 --- a/nptl/sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c +++ b/nptl/sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c @@ -25,9 +25,6 @@ #include <shlib-compat.h> -/* Defined in pthread_setaffinity.c. */ -extern size_t __kernel_cpumask_size attribute_hidden; -extern int __determine_cpumask_size (pid_t tid); int @@ -47,21 +44,10 @@ __pthread_attr_setaffinity_new (pthread_attr_t *attr, size_t cpusetsize, } else { - if (__kernel_cpumask_size == 0) - { - int res = __determine_cpumask_size (THREAD_SELF->tid); - if (res != 0) - /* Some serious problem. */ - return res; - } + int ret = check_cpuset_attr (cpuset, cpusetsize); - /* Check whether the new bitmask has any bit set beyond the - last one the kernel accepts. */ - for (size_t cnt = __kernel_cpumask_size; cnt < cpusetsize; ++cnt) - if (((char *) cpuset)[cnt] != '\0') - /* Found a nonzero byte. This means the user request cannot be - fulfilled. */ - return EINVAL; + if (ret) + return ret; if (iattr->cpusetsize != cpusetsize) { |