Deleted Added
full compact
kern_shutdown.c (137266) kern_shutdown.c (137329)
1/*-
2 * Copyright (c) 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
35 */
36
37#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/kern_shutdown.c 137266 2004-11-05 19:00:23Z peter $");
38__FBSDID("$FreeBSD: head/sys/kern/kern_shutdown.c 137329 2004-11-07 06:58:45Z njl $");
39
40#include "opt_kdb.h"
41#include "opt_mac.h"
42#include "opt_panic.h"
43#include "opt_show_busybufs.h"
44#include "opt_sched.h"
45
46#include <sys/param.h>

--- 186 unchanged lines hidden (view full) ---

233
234 savectx(&dumppcb);
235 dumptid = curthread->td_tid;
236 dumping++;
237 dumpsys(&dumper);
238}
239
240/*
39
40#include "opt_kdb.h"
41#include "opt_mac.h"
42#include "opt_panic.h"
43#include "opt_show_busybufs.h"
44#include "opt_sched.h"
45
46#include <sys/param.h>

--- 186 unchanged lines hidden (view full) ---

233
234 savectx(&dumppcb);
235 dumptid = curthread->td_tid;
236 dumping++;
237 dumpsys(&dumper);
238}
239
240/*
241 * Go through the rigmarole of shutting down..
242 * this used to be in machdep.c but I'll be dammned if I could see
243 * anything machine dependant in it.
241 * Shutdown the system cleanly to prepare for reboot, halt, or power off.
244 */
245static void
246boot(int howto)
247{
248 static int first_buf_printf = 1;
249
250#if defined(SMP) && (defined(__i386__) || defined(__amd64__))
242 */
243static void
244boot(int howto)
245{
246 static int first_buf_printf = 1;
247
248#if defined(SMP) && (defined(__i386__) || defined(__amd64__))
251 /* Do all shutdown processing on cpu0 */
249 /*
250 * Bind us to CPU 0 so that all shutdown code runs there. Some
251 * systems don't shutdown properly (i.e., ACPI power off) if we
252 * run on another processor.
253 */
252 mtx_lock_spin(&sched_lock);
253 sched_bind(curthread, 0);
254 mtx_unlock_spin(&sched_lock);
255#endif
256
257 /* collect extra flags that shutdown_nice might have set */
258 howto |= shutdown_howto;
259

--- 126 unchanged lines hidden (view full) ---

386
387 print_uptime();
388
389 /*
390 * Ok, now do things that assume all filesystem activity has
391 * been completed.
392 */
393 EVENTHANDLER_INVOKE(shutdown_post_sync, howto);
254 mtx_lock_spin(&sched_lock);
255 sched_bind(curthread, 0);
256 mtx_unlock_spin(&sched_lock);
257#endif
258
259 /* collect extra flags that shutdown_nice might have set */
260 howto |= shutdown_howto;
261

--- 126 unchanged lines hidden (view full) ---

388
389 print_uptime();
390
391 /*
392 * Ok, now do things that assume all filesystem activity has
393 * been completed.
394 */
395 EVENTHANDLER_INVOKE(shutdown_post_sync, howto);
396
397 /* XXX This doesn't disable interrupts any more. Reconsider? */
394 splhigh();
398 splhigh();
399
395 if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping)
396 doadump();
397
398 /* Now that we're going to really halt the system... */
399 EVENTHANDLER_INVOKE(shutdown_final, howto);
400
401 for(;;) ; /* safety against shutdown_reset not working */
402 /* NOTREACHED */

--- 228 unchanged lines hidden ---
400 if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping)
401 doadump();
402
403 /* Now that we're going to really halt the system... */
404 EVENTHANDLER_INVOKE(shutdown_final, howto);
405
406 for(;;) ; /* safety against shutdown_reset not working */
407 /* NOTREACHED */

--- 228 unchanged lines hidden ---