sysmgr_runstate(), sysmgr_runstate_dynamic()

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
Zero to offline the processor; non-zero to bring it back online. 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 offline or online the specified CPU as follows:

These settings work together:

Runstate Dynamic runstate Action
0 The CPU is permanently offline
1 0 The CPU is permanently online (the default)
1 1 The CPU is dynamically brought on- or offline 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().
  • These functions don't turn the power on or off for the CPU; they tell the kernel whether or not to schedule threads on it. If you take a CPU offline, it sits on a WFI instruction (for ARM), or a HLT instruction (for x86). If you want to turn the power off for an idle CPU, use InterruptHookIdle2() to register a callback that shuts it down.

You can use sysmgr_runstate_burst() to notify the kernel that it should bring CPUs online because the system is about to get busy.

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