p_online(2)


p_online -- take a processor online or offline or disable it

Synopsis

   #include <sys/types.h>
   #include <sys/processor.h>
   

int p_online(processorid_t processorid, int flag);

Description

p_online brings the processor specified by processorid online or takes it offline. p_online also disables the processor specified by processorid to prepare it for physical removal from a system which supports the hot plugging of CPUs. When a processor is online, it is performing normal operations, scheduling and executing processes, and servicing any I/O devices to which it has access.

If flag is P_ONLINE, the specified processor is brought online. If the processor was already online, nothing is done. The previous state of the processor (P_ONLINE or P_OFFLINE) is returned.

If flag is P_OFFLINE, the specified processor is shut down and taken offline. If the processor was already offline, nothing is done. The previous state of the processor is returned. An attempt to take a processor offline may fail for several reasons:

If flag is P_DISABLE, the specified processor is disabled and can then be physically removed from a system which supports the hot plugging of CPUs. If the processor is not physically present in the system, nothing is done. If disabling is requested in a system that does not support the hot plugging of CPUs, this function simply offlines the specified processor.

The calling process must have appropriate privileges to bring a processor online, take it offline, or disable it.

Return values

On success, p_online returns P_ONLINE, P_OFFLINE, or P_DISABLE. On failure, p_online returns -1 and sets errno to identify the error.

Errors

In the following conditions, p_online fails and sets errno to:

EPERM
The calling process does not have appropriate privilege for the operation.

EINVAL
The processorid does not refer to an existing processor, or the processor for P_OFFLINE cannot be taken offline, the number of processors has reached the limit, or the flag has an invalid value.

EBUSY
The processorid for P_OFFLINE refers to a processor with processes bound to it, it is the only online processor, or the processor performs some essential system function that cannot be taken over by another processor.

EIO
The processor to which processorid refers cannot be brought online.

ENODEV
The processor to which processorid refers is not physically present in the hot plug system when flag is either P_ONLINE or P_OFFLINE.

References

psradm(1M)

Notices

Considerations for lightweight processes

Specific LWP, sets of LWPS, as well as entire processes can be bound to a processor. See processor_bind(2).
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004