summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/pthreadattrsetaffinitynp.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-06 10:07:38 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-09 14:52:58 +0200
commitaf9115f35cfb3d0adeb3e105fd608883596f2637 (patch)
treed6638dc66e87ad1736f7675f79e7e6d116e5c463 /cpukit/posix/src/pthreadattrsetaffinitynp.c
parentscore: Change Timestamp_Control to sbintime_t (diff)
downloadrtems-af9115f35cfb3d0adeb3e105fd608883596f2637.tar.bz2
posix: Simplify POSIX_API_Control
Return stack area via pthread_getattr_np(). Simplify * pthread_attr_setaffinity_np(), and * pthread_attr_getaffinity_np() and let the scheduler do the more sophisticated error checks. Make * pthread_setaffinity_np(), * pthread_getaffinity_np(), * pthread_attr_setaffinity_np(), and * pthread_attr_getaffinity_np() available in all configurations. Update #2514. Close #3145. Close #3168.
Diffstat (limited to 'cpukit/posix/src/pthreadattrsetaffinitynp.c')
-rw-r--r--cpukit/posix/src/pthreadattrsetaffinitynp.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/cpukit/posix/src/pthreadattrsetaffinitynp.c b/cpukit/posix/src/pthreadattrsetaffinitynp.c
index e5462ec5c4..0e3c828c38 100644
--- a/cpukit/posix/src/pthreadattrsetaffinitynp.c
+++ b/cpukit/posix/src/pthreadattrsetaffinitynp.c
@@ -24,27 +24,21 @@
#include <pthread.h>
#include <errno.h>
-#include <rtems/posix/pthreadimpl.h>
-#include <rtems/posix/priorityimpl.h>
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/cpusetimpl.h>
-
int pthread_attr_setaffinity_np(
pthread_attr_t *attr,
size_t cpusetsize,
const cpu_set_t *cpuset
)
{
- if ( !cpuset )
- return EFAULT;
- if ( !attr )
- return EFAULT;
+ if ( attr == NULL || !attr->is_initialized ) {
+ return EINVAL;
+ }
- if (! _CPU_set_Is_valid( cpuset, cpusetsize ) )
+ if ( cpuset == NULL || cpusetsize != attr->affinitysetsize ) {
return EINVAL;
+ }
CPU_COPY( cpuset, attr->affinityset );
-
return 0;
}