reboot Subroutine

Purpose

Restarts the system.

Library

Standard C Library (libc.a)

Syntax

#include <sys/reboot.h>

void reboot ( HowTo,  Argument)
int HowTo;
void *Argument;

Description

The reboot subroutine restarts or re-initial program loads (IPL) the system. The startup is automatic and brings up /unix in the normal, nonmaintenance mode.

Note: The routine may coredump instead of returning EFAULT when an invalid pointer is passed in case of 64-bit application calling 32-bit kernel interface.

The calling process must have root user authority in order to run this subroutine successfully.

Attention: Users of the reboot subroutine are not portable. The reboot subroutine is intended for use only by the halt, reboot, and shutdown commands.

Parameters

Item Description
HowTo Specifies one of the following values:
RB_SOFTIPL
Soft IPL.
RB_HALT
Halt operator; turn the power off.
RB_POWIPL
Halt operator; turn the power off. Wait a specified length of time, and then turn the power on.
Item Description
Argument Specifies the amount of time (in seconds) to wait between turning the power off and turning the power on. This option is not supported on all models. Please consult your hardware technical reference for more details.

Return Values

Upon successful completion, the reboot subroutine does not return a value. If the reboot subroutine fails, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The reboot subroutine is unsuccessful if any of the following is true:

Item Description
EPERM The calling process does not have root user authority.
EINVAL The HowTo value is not valid.
EFAULT The Argument value is not a valid address.