4.115
Last change
on this file since 6e6adafa was
6e6adafa,
checked in by Jennifer Averett <jennifer.averett@…>, on 02/06/14 at 18:59:08
|
posix: Add pthread_attr_t methods to get/set affinity.
This patch adds the following methods:
+ pthread_attr_get_affinity_np
+ pthread_attr_set_affinity_np
|
-
Property mode set to
100644
|
File size:
924 bytes
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Pthread Attribute Get Affinity |
---|
5 | * @ingroup POSIXAPI |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 2014. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #if HAVE_DECL_PTHREAD_ATTR_GETAFFINITY_NP |
---|
22 | |
---|
23 | #define _GNU_SOURCE |
---|
24 | #include <pthread.h> |
---|
25 | #include <errno.h> |
---|
26 | |
---|
27 | #include <rtems/posix/pthreadimpl.h> |
---|
28 | #include <rtems/posix/priorityimpl.h> |
---|
29 | #include <rtems/score/threadimpl.h> |
---|
30 | |
---|
31 | int pthread_attr_getaffinity_np( |
---|
32 | const pthread_attr_t *attr, |
---|
33 | size_t cpusetsize, |
---|
34 | cpu_set_t *cpuset |
---|
35 | ) |
---|
36 | { |
---|
37 | if ( !cpuset ) |
---|
38 | return EFAULT; |
---|
39 | if ( !attr ) |
---|
40 | return EFAULT; |
---|
41 | |
---|
42 | if ( cpusetsize != attr->affinitysetsize) |
---|
43 | return EINVAL; |
---|
44 | |
---|
45 | CPU_COPY( cpuset, attr->affinityset ); |
---|
46 | return 0; |
---|
47 | } |
---|
48 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.