2002-10-14 17:43:14 +04:00
|
|
|
.\" $NetBSD: cpu_reboot.9,v 1.13 2002/10/14 13:43:20 wiz Exp $
|
1995-11-26 00:24:47 +03:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1994 Christopher G. Demetriou
|
|
|
|
.\" All rights reserved.
|
2001-09-04 06:51:15 +04:00
|
|
|
.\"
|
1995-11-26 00:24:47 +03:00
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
2000-06-14 21:24:02 +04:00
|
|
|
.\" This product includes software developed for the
|
|
|
|
.\" NetBSD Project. See http://www.netbsd.org/ for
|
|
|
|
.\" information about NetBSD.
|
1999-04-07 00:24:37 +04:00
|
|
|
.\" 4. The name of the author may not be used to endorse or promote products
|
2000-06-14 21:24:02 +04:00
|
|
|
.\" derived from this software without specific prior written permission.
|
2001-09-04 06:51:15 +04:00
|
|
|
.\"
|
1995-11-26 00:24:47 +03:00
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2001-09-04 06:51:15 +04:00
|
|
|
.\"
|
2000-06-14 21:24:02 +04:00
|
|
|
.\" <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
|
1995-11-26 00:24:47 +03:00
|
|
|
.\"
|
|
|
|
.Dd November 13, 1995
|
1997-03-27 23:15:05 +03:00
|
|
|
.Dt CPU_REBOOT 9
|
1999-03-16 03:40:46 +03:00
|
|
|
.Os
|
1995-11-26 00:24:47 +03:00
|
|
|
.Sh NAME
|
1997-03-27 23:15:05 +03:00
|
|
|
.Nm cpu_reboot
|
1995-11-26 00:24:47 +03:00
|
|
|
.Nd halt or reboot the system
|
|
|
|
.Sh SYNOPSIS
|
2002-02-13 11:17:26 +03:00
|
|
|
.Fd #include \*[Lt]sys/reboot.h\*[Gt]
|
1995-11-26 00:24:47 +03:00
|
|
|
.Ft void
|
1997-03-27 23:15:05 +03:00
|
|
|
.Fn cpu_reboot "int howto" "char *bootstr"
|
1995-11-26 00:24:47 +03:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
1997-03-27 23:15:05 +03:00
|
|
|
.Fn cpu_reboot
|
1995-11-26 00:24:47 +03:00
|
|
|
function handles final system shutdown, and either halts or reboots
|
2002-10-14 17:43:14 +04:00
|
|
|
the system.
|
|
|
|
The exact action to be taken is determined by the flags passed in
|
1995-11-26 00:24:47 +03:00
|
|
|
.Fa howto
|
|
|
|
and by whether or not the system has finished autoconfiguration.
|
|
|
|
.Pp
|
|
|
|
If the system has finished autoconfiguration,
|
1997-03-27 23:15:05 +03:00
|
|
|
.Fn cpu_reboot
|
1995-11-26 00:24:47 +03:00
|
|
|
does the following:
|
|
|
|
.Bl -enum -offset indent
|
|
|
|
.It
|
|
|
|
Sets the
|
|
|
|
.Va boothowto
|
|
|
|
system variable from the
|
|
|
|
.Fa howto
|
|
|
|
argument.
|
|
|
|
.It
|
|
|
|
If this is the first invocation of
|
1997-03-27 23:15:05 +03:00
|
|
|
.Fn cpu_reboot
|
1995-11-26 00:24:47 +03:00
|
|
|
and the
|
|
|
|
.Dv RB_NOSYNC
|
|
|
|
flag is not set in
|
|
|
|
.Fa howto ,
|
|
|
|
syncs and unmounts the system disks by calling
|
|
|
|
.Xr vfs_shutdown 9
|
|
|
|
and sets the time of day clock by calling
|
|
|
|
.Xr resettodr 9 .
|
|
|
|
.It
|
|
|
|
Disables interrupts.
|
|
|
|
.It
|
2002-10-14 17:43:14 +04:00
|
|
|
If rebooting after a crash (i.e., if
|
1995-11-26 00:24:47 +03:00
|
|
|
.Dv RB_DUMP
|
|
|
|
is set in
|
|
|
|
.Fa howto ,
|
|
|
|
but
|
|
|
|
.Dv RB_HALT
|
|
|
|
is not), saves a system crash dump.
|
|
|
|
.It
|
|
|
|
Runs any shutdown hooks by calling
|
|
|
|
.Xr doshutdownhooks 9 .
|
|
|
|
.It
|
|
|
|
Prints a message indicating that the system is about to be halted
|
|
|
|
or rebooted.
|
|
|
|
.It
|
|
|
|
If
|
|
|
|
.Dv RB_HALT
|
|
|
|
is set in
|
|
|
|
.Fa howto ,
|
|
|
|
halts the system.
|
|
|
|
Otherwise, reboots the system.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
If the system has not finished autoconfiguration,
|
1997-03-27 23:15:05 +03:00
|
|
|
.Fn cpu_reboot
|
1995-11-26 00:24:47 +03:00
|
|
|
runs any shutdown hooks by calling
|
|
|
|
.Xr doshutdownhooks 9 ,
|
|
|
|
prints a message, and halts the system.
|
1996-09-24 11:01:26 +04:00
|
|
|
.Pp
|
|
|
|
If
|
|
|
|
.Dv RB_STRING
|
|
|
|
is set in
|
|
|
|
.Pa howto ,
|
|
|
|
then the parameter
|
|
|
|
.Fa bootstr
|
|
|
|
is passed to the system boot loader on some ports.
|
1995-11-26 00:24:47 +03:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr doshutdownhooks 9 ,
|
2002-05-25 14:44:22 +04:00
|
|
|
.Xr dumpsys 9 ,
|
2001-04-29 23:18:20 +04:00
|
|
|
.Xr resettodr 9
|
|
|
|
.\" .Xr vfs_shutdown 9
|