AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
reboot.c File Reference

Restarting, halting and powering off the machine (reboot()), and Ctrl+Alt+Del. More...

#include <core/system.h>
#include <core/arch.h>
#include <sys/proc.h>
#include <sys/signal.h>
#include <sys/reboot.h>
#include <dev/dev.h>
#include <aquila/errno.h>

Go to the source code of this file.

Functions

int kernel_reboot (unsigned cmd)
 Carries out a reboot() command.
void kernel_ctrlaltdel (void)
 Handles Ctrl+Alt+Del from the keyboard, possibly in an interrupt: it restarts the machine, or sends SIGINT to init if init asked for that.

Variables

static int cad_restarts = 1

Detailed Description

Restarting, halting and powering off the machine (reboot()), and Ctrl+Alt+Del.

Ctrl+Alt+Del restarts the machine right away, unless init asked for SIGINT instead (RB_DISABLE_CAD), to shut down cleanly.

Definition in file reboot.c.

Function Documentation

◆ kernel_ctrlaltdel()

void kernel_ctrlaltdel ( void )

Handles Ctrl+Alt+Del from the keyboard, possibly in an interrupt: it restarts the machine, or sends SIGINT to init if init asked for that.

Definition at line 62 of file reboot.c.

References arch_reboot(), cad_restarts, kernel_ctrlaltdel(), printk(), proc_pid_find(), and signal_proc_send().

Referenced by kernel_ctrlaltdel(), and vt_scancode().

◆ kernel_reboot()

int kernel_reboot ( unsigned cmd)

Carries out a reboot() command.

Before restarting, halting or powering off, the disks' caches are written out.

Parameters
cmdRB_AUTOBOOT, RB_HALT_SYSTEM, RB_POWER_OFF, RB_ENABLE_CAD or RB_DISABLE_CAD
Returns
0 for RB_ENABLE_CAD and RB_DISABLE_CAD, or -EINVAL for an unknown command; the others don't return

Definition at line 29 of file reboot.c.

References arch_halt(), arch_poweroff(), arch_reboot(), cad_restarts, kdev_sync(), kernel_reboot(), and printk().

Referenced by kernel_reboot(), and sys_reboot().

Variable Documentation

◆ cad_restarts

int cad_restarts = 1
static

Definition at line 18 of file reboot.c.

Referenced by kernel_ctrlaltdel(), and kernel_reboot().