Change the runstate of a processor
Synopsis:
#include <sys/sysmgr.h>
int sysmgr_runstate( unsigned cpu,
int enable );
int sysmgr_runstate_dynamic( unsigned cpu,
int enable );
Arguments:
- cpu
- The index of the CPU whose state you want to change.
- enable
- 0 to turn the processor off; non-zero to turn it on.
For more details, see below.
Library:
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
Description:
The sysmgr_runstate() and sysmgr_runstate_dynamic() functions
turn the specified CPU on or off as follows:
- sysmgr_runstate() takes a CPU down manually (if enable is zero) or lets it run (if one).
- sysmgr_runstate_dynamic() lets the kernel dynamically bring a CPU up or down
(if enable is one), depending on the system load.
These settings work together:
Runstate |
Dynamic runstate |
Action |
0 |
— |
The CPU is permanently off |
1 |
0 |
The CPU is permanently on (the default) |
1 |
1 |
The CPU is dynamically brought up or down by the kernel, depending on load. |
Note:
In order to successfully change the state, your process must have the
PROCMGR_AID_RUNSTATE ability enabled.
For more information, see
procmgr_ability().
Errors:
- EINVAL
- The CPU index is invalid.
- EOK
- Success.
- EPERM
- The calling process doesn't have the required permission; see
procmgr_ability().
Classification:
QNX Neutrino
Safety: |
|
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |