up | Inhaltsverzeichniss | Kommentar

Manual page for p_online(2)

p_online - change processor operational status

SYNOPSIS

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

int p_online(processorid_t processorid, int flag);

DESCRIPTION

The processor specified by the first argument is set on-line or off-line or is unchanged, depending on whether the flag argument is P_ONLINE, P_OFFLINE, or P_STATUS.

When P_ONLINE is specified and the processor is off-line, the processor is brought on-line and allowed to process LWPs (lightweight processes) and perform system activities.

When P_ONLINE or P_OFFLINE is specified and the processor is powered off, it is powered on. In the P_ONLINE case, the processor is also brought on-line and allowed to process LWPs (lightweight processes) and perform system activities.

When P_OFFLINE is specified and the processor is on-line, it is taken off-line and not allowed to process LWPs. The processor will become as inactive as possible.

When P_STATUS is specified, no change occurs, but the current status is returned.

Processor numbers are integers, greater than or equal to 0, and are defined by the hardware platform. Processor numbers are not necessarily contiguous, but ``not too sparse.'' Processor numbers should always be printed in decimal.

The number of processors present can be determined by calling sysconf(_SC_NPROCESSORS_CONF). The list of valid processor numbers can be determined by calling p_online() with processorid values starting at 0 until all processors have been found. The EINVAL error is returned for invalid processor numbers. See EXAMPLES below.

RETURN VALUES

On successful completion, the value returned is the previous state of the processor, P_ONLINE, P_OFFLINE, or P_POWEROFF. Otherwise, -1 is returned and errno is set to indicate the error.

ERRORS

The p_online() function will fail if:
EPERM
The effective user of the calling process is not super-user.
EINVAL
A non-existent processor ID was specified or flag was invalid.
EBUSY
The flag was P_OFFLINE and the specified processor is the only on-line processor, there are currently LWPs bound to the processor, or the processor performs some essential function that cannot be performed by another processor.
EBUSY
The specified processor is powered off and cannot be powered on because some platform- specific resource is not available.
ENOTSUP
The specified processor is powered off, and the platform does not support power on of individual processors.

EXAMPLES

The following function will list the legal processor numbers:

#include <sys/unistd.h>
#include <sys/processor.h>
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>

int
main()
{
    processorid_t i;
    int     status;
    int     n = sysconf(_SC_NPROCESSORS_ONLN);
    for (i = 0; n > 0; i++) {
	    status = p_online(i, P_STATUS);
	    if (status == -1 && errno == EINVAL)
		    continue;
	    printf("processor %d present\n", i);
	    n--;
    }
    return (0);
}

SEE ALSO

psradm.1m psrinfo.1m processor_bind.2 processor_info.2 pset_create.2 sysconf.3c


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).

Last modified 07/October/97