source: rtems/cpukit/posix/src/pthreadattrsetaffinitynp.c @ 77fbbd6

5
Last change on this file since 77fbbd6 was af9115f3, checked in by Sebastian Huber <sebastian.huber@…>, on 10/06/17 at 08:07:38

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.

  • Property mode set to 100644
File size: 831 bytes
Line 
1#if HAVE_CONFIG_H
2#include "config.h"
3#endif
4
5/**
6 * @file
7 *
8 * @brief Pthread Attribute Set Affinity
9 * @ingroup POSIXAPI
10 */
11
12/*
13 *  COPYRIGHT (c) 2014.
14 *  On-Line Applications Research Corporation (OAR).
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.rtems.org/license/LICENSE.
19 */
20
21#if HAVE_DECL_PTHREAD_ATTR_SETAFFINITY_NP
22
23#define  _GNU_SOURCE
24#include <pthread.h>
25#include <errno.h>
26
27int pthread_attr_setaffinity_np(
28  pthread_attr_t    *attr,
29  size_t             cpusetsize,
30  const cpu_set_t   *cpuset
31)
32{
33  if ( attr == NULL || !attr->is_initialized ) {
34    return EINVAL;
35  }
36
37  if ( cpuset == NULL || cpusetsize != attr->affinitysetsize ) {
38    return EINVAL;
39  }
40
41  CPU_COPY( cpuset, attr->affinityset );
42  return 0;
43}
44
45#endif
Note: See TracBrowser for help on using the repository browser.