From 1b67535d86c6a92cda1b08759293c20b7fab6978 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 9 Apr 2014 10:09:57 +0200 Subject: rtems: Add scheduler get processors --- cpukit/rtems/src/schedulergetprocessorset.c | 54 +++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 cpukit/rtems/src/schedulergetprocessorset.c (limited to 'cpukit/rtems/src/schedulergetprocessorset.c') diff --git a/cpukit/rtems/src/schedulergetprocessorset.c b/cpukit/rtems/src/schedulergetprocessorset.c new file mode 100644 index 0000000000..e459b178cc --- /dev/null +++ b/cpukit/rtems/src/schedulergetprocessorset.c @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2014 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#if HAVE_CONFIG_H + #include "config.h" +#endif + +#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) + +#include +#include +#include + +rtems_status_code rtems_scheduler_get_processor_set( + rtems_id scheduler_id, + size_t cpusetsize, + cpu_set_t *cpuset +) +{ + rtems_status_code sc; + + if ( cpuset != NULL ) { + const Scheduler_Control *scheduler; + + if ( _Scheduler_Get_by_id( scheduler_id, &scheduler ) ) { + if ( _CPU_set_Is_large_enough( cpusetsize ) ) { + _Scheduler_Get_processor_set( scheduler, cpusetsize, cpuset ); + + sc = RTEMS_SUCCESSFUL; + } else { + sc = RTEMS_INVALID_NUMBER; + } + } else { + sc = RTEMS_INVALID_ID; + } + } else { + sc = RTEMS_INVALID_ADDRESS; + } + + return sc; +} + +#endif /* defined(__RTEMS_HAVE_SYS_CPUSET_H__) */ -- cgit v1.2.3