source: rtems/cpukit/rtems/src/taskgetaffinity.c @ e6b31b27

4.115
Last change on this file since e6b31b27 was a92c488, checked in by Sebastian Huber <sebastian.huber@…>, on 05/28/14 at 15:56:45

score: _Scheduler_Get_affinity()

Drop scheduler parameter. Coding style.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 * @file
3 *
4 * @brief  RTEMS Task Get Affinity
5 * @ingroup ClassicTasks Tasks
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 defined(__RTEMS_HAVE_SYS_CPUSET_H__)
22
23#include <rtems/rtems/tasks.h>
24#include <rtems/score/threadimpl.h>
25#include <rtems/score/cpusetimpl.h>
26#include <rtems/score/schedulerimpl.h>
27
28
29rtems_status_code rtems_task_get_affinity(
30  rtems_id             id,
31  size_t               cpusetsize,
32  cpu_set_t           *cpuset
33)
34{
35  Thread_Control        *the_thread;
36  Objects_Locations      location;
37  bool                   ok;
38
39  if ( !cpuset )
40    return RTEMS_INVALID_ADDRESS;
41
42  the_thread = _Thread_Get( id, &location );
43
44  switch ( location ) {
45
46    case OBJECTS_LOCAL:
47      ok = _Scheduler_Get_affinity(
48        the_thread,
49        cpusetsize,
50        cpuset
51      );
52      _Objects_Put( &the_thread->Object );
53      return ok ? RTEMS_SUCCESSFUL : RTEMS_INVALID_NUMBER;
54
55#if defined(RTEMS_MULTIPROCESSING)
56    case OBJECTS_REMOTE:
57#endif
58
59    case OBJECTS_ERROR:
60      break;
61  }
62
63  return RTEMS_INVALID_ID;
64}
65#endif
Note: See TracBrowser for help on using the repository browser.