#define RB_HALT 1 #define RB_POWEROFF 2 #define RB_RESTART 3 #define RB_ERROR_RET 0b1 int reboot(int cmd, int flags);
This syscall does the passed action to the system’s power management, the
action is specified with cmd
, it can be one of:
RB_HALT
System activity is terminated and the system will make all needed preparations, but power will not be cut off, instead, the user will have to do so, say, with the power button. Data syncing is up to the user.
RB_POWEROFF
The same as RB_HALT
but actually cuts power.
RB_RESTART
The same as RB_HALT
but at the end, the system will reboot.
If the operation fails internally, for any reason, the kernel will panic, for
returning an error instead, one can use RB_ERROR_RET
in flags
.
This syscall does not return on success, it will only return in the case of
invalid value for cmd
, before comitting to an operation, or by using
RB_ERROR_RET
as previously said. In error, -1
will be returned,
and errno will be set to:
EINVAL
The passed cmd
is not valid.
EACCES
MAC did not allow this.
EIO
The operation failed internally.