RTEMS
schedulergetprocessorset.c
1 /*
2  * Copyright (c) 2014, 2017 embedded brains GmbH. All rights reserved.
3  *
4  * embedded brains GmbH
5  * Dornierstr. 4
6  * 82178 Puchheim
7  * Germany
8  * <rtems@embedded-brains.de>
9  *
10  * The license and distribution terms for this file may be
11  * found in the file LICENSE in this distribution or at
12  * http://www.rtems.org/license/LICENSE.
13  */
14 
15 #ifdef HAVE_CONFIG_H
16 #include "config.h"
17 #endif
18 
19 #include <rtems/rtems/tasks.h>
21 
23  rtems_id scheduler_id,
24  size_t cpusetsize,
25  cpu_set_t *cpuset
26 )
27 {
28  const Scheduler_Control *scheduler;
29  const Processor_mask *processor_set;
30  Processor_mask_Copy_status status;
31 
32  if ( cpuset == NULL ) {
33  return RTEMS_INVALID_ADDRESS;
34  }
35 
36  scheduler = _Scheduler_Get_by_id( scheduler_id );
37  if ( scheduler == NULL ) {
38  return RTEMS_INVALID_ID;
39  }
40 
41  processor_set = _Scheduler_Get_processors( scheduler );
42  status = _Processor_mask_To_cpu_set_t( processor_set, cpusetsize, cpuset );
43  if ( status != PROCESSOR_MASK_COPY_LOSSLESS ) {
44  return RTEMS_INVALID_NUMBER;
45  }
46 
47  return RTEMS_SUCCESSFUL;
48 }
rtems_status_code rtems_scheduler_get_processor_set(rtems_id scheduler_id, size_t cpusetsize, cpu_set_t *cpuset)
Gets the set of processors owned by the scheduler instance.
Inlined Routines Associated with the Manipulation of the Scheduler.
RTEMS_INLINE_ROUTINE Processor_mask_Copy_status _Processor_mask_To_cpu_set_t(const Processor_mask *src, size_t dst_size, cpu_set_t *dst)
Copies one mask to another.
This status code indicates that a specified number was invalid.
Definition: status.h:138
This status code indicates successful completion.
Definition: status.h:86
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
static __inline__ const Processor_mask * _Scheduler_Get_processors(const Scheduler_Control *scheduler)
Gets the processors of the scheduler.
This header file defines the main parts of the Tasks Manager API.
This status code indicates that a specified address was invalid.
Definition: status.h:133
This status code indicates that an object identifier was invalid.
Definition: status.h:106
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
Scheduler control.
Definition: scheduler.h:264
static __inline__ const Scheduler_Control * _Scheduler_Get_by_id(Objects_Id id)
Gets the scheduler from the given object build id.