source: rtems/cpukit/rtems/src/taskgetaffinity.c @ 6b5f22dc

Last change on this file since 6b5f22dc was 6b5f22dc, checked in by Sebastian Huber <sebastian.huber@…>, on 11/26/20 at 10:45:47

rtems: Canonicalize Doxygen @file comments

Use common phrases for the file brief descriptions.

Update #3706.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSImplClassicTask
5 *
6 * @brief This source file contains the implementation of
7 *   rtems_task_get_affinity().
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#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <rtems/rtems/tasks.h>
24#include <rtems/score/threadimpl.h>
25#include <rtems/score/schedulerimpl.h>
26
27rtems_status_code rtems_task_get_affinity(
28  rtems_id   id,
29  size_t     cpusetsize,
30  cpu_set_t *cpuset
31)
32{
33  Thread_Control   *the_thread;
34  ISR_lock_Context  lock_context;
35  Per_CPU_Control  *cpu_self;
36  bool              ok;
37
38  if ( cpuset == NULL ) {
39    return RTEMS_INVALID_ADDRESS;
40  }
41
42  the_thread = _Thread_Get( id, &lock_context );
43
44  if ( the_thread == NULL ) {
45#if defined(RTEMS_MULTIPROCESSING)
46    if ( _Thread_MP_Is_remote( id ) ) {
47      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
48    }
49#endif
50
51    return RTEMS_INVALID_ID;
52  }
53
54  cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
55  _Thread_State_acquire_critical( the_thread, &lock_context );
56
57  ok = _Scheduler_Get_affinity(
58    the_thread,
59    cpusetsize,
60    cpuset
61  );
62
63  _Thread_State_release( the_thread, &lock_context );
64  _Thread_Dispatch_enable( cpu_self );
65  return ok ? RTEMS_SUCCESSFUL : RTEMS_INVALID_NUMBER;
66}
Note: See TracBrowser for help on using the repository browser.