source: rtems/cpukit/score/include/rtems/score/cpusetimpl.h @ 0712d17

4.11
Last change on this file since 0712d17 was 0712d17, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 8, 2014 at 9:14:27 AM

score: Task get/set affinity

Make rtems_task_get_affinity() and rtems_task_set_affinity() available
on non-SMP configurations. Allow larger CPU sets.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/**
2 *  @file  rtems/score/cpusetimpl.h
3 *
4 *  @brief Implementation Prototypes for CPU Set
5 *
6 *  This file contains the implementation prototypes for
7 *  CPU set methods.
8 */
9
10/*
11 *  COPYRIGHT (c) 2014.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifndef _RTEMS_SCORE_CPUSETIMPL_H
20#define _RTEMS_SCORE_CPUSETIMPL_H
21
22#include <rtems/score/cpuset.h>
23#include <rtems/score/smp.h>
24
25#include <limits.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#ifdef __RTEMS_HAVE_SYS_CPUSET_H__
32
33/**
34 * _CPU_set_Is_valid
35 *
36 * This routine validates a cpuset size corresponds to
37 * the system correct size, that at least one
38 * valid cpu is set and that no invalid cpus are set.
39 */
40bool _CPU_set_Is_valid( const cpu_set_t *cpuset, size_t setsize );
41
42/**
43 * _CPU_set_Show
44 *
45 * This routine will print the value of the given cpuset.
46 */
47void _CPU_set_Show( const char *description, const cpu_set_t   *cpuset);
48
49/**
50 * _CPU_set_Show_default
51 *
52 * This routine will print the value of the default cpuset.
53 */
54void _CPU_set_Show_default( const char *description );
55
56/**
57 * _CPU_set_Default
58 *
59 * This routine returns the default cpuset for
60 * this system.
61 */
62const CPU_set_Control *_CPU_set_Default(void);
63
64RTEMS_INLINE_ROUTINE size_t _CPU_set_Maximum_CPU_count(
65  size_t cpusetsize
66)
67{
68  return cpusetsize * CHAR_BIT;
69}
70
71RTEMS_INLINE_ROUTINE bool _CPU_set_Is_large_enough(
72  size_t cpusetsize
73)
74{
75  return _CPU_set_Maximum_CPU_count( cpusetsize )
76    >= _SMP_Get_processor_count();
77}
78
79#endif
80
81/**
82 * _CPU_set_Handler_initialization
83 *
84 * This routine validates a cpuset sets at least one
85 * valid cpu and that it does not set any invalid
86 * cpus.
87 */
88
89#if __RTEMS_HAVE_SYS_CPUSET_H__ && defined( RTEMS_SMP )
90void _CPU_set_Handler_initialization(void);
91#else
92#define _CPU_set_Handler_initialization()  do { } while ( 0 )
93#endif
94
95/**@}*/
96
97#ifdef __cplusplus
98}
99#endif
100#endif
101/* end of include file */
Note: See TracBrowser for help on using the repository browser.