kern_shutdown.c (54248) | kern_shutdown.c (55539) |
---|---|
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. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 | 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. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 |
39 * $FreeBSD: head/sys/kern/kern_shutdown.c 54248 1999-12-07 04:35:37Z msmith $ | 39 * $FreeBSD: head/sys/kern/kern_shutdown.c 55539 2000-01-07 08:36:44Z luoqi $ |
40 */ 41 42#include "opt_ddb.h" 43#include "opt_hw_wdog.h" 44#include "opt_panic.h" 45#include "opt_show_busybufs.h" 46 47#include <sys/param.h> 48#include <sys/systm.h> 49#include <sys/eventhandler.h> 50#include <sys/buf.h> 51#include <sys/reboot.h> 52#include <sys/proc.h> 53#include <sys/vnode.h> 54#include <sys/kernel.h> | 40 */ 41 42#include "opt_ddb.h" 43#include "opt_hw_wdog.h" 44#include "opt_panic.h" 45#include "opt_show_busybufs.h" 46 47#include <sys/param.h> 48#include <sys/systm.h> 49#include <sys/eventhandler.h> 50#include <sys/buf.h> 51#include <sys/reboot.h> 52#include <sys/proc.h> 53#include <sys/vnode.h> 54#include <sys/kernel.h> |
55#include <sys/kthread.h> |
|
55#include <sys/mount.h> 56#include <sys/queue.h> 57#include <sys/sysctl.h> 58#include <sys/conf.h> 59#include <sys/sysproto.h> 60#include <sys/cons.h> 61 62#include <machine/pcb.h> --- 503 unchanged lines hidden (view full) --- 566 567static void 568poweroff_wait(void *junk, int howto) 569{ 570 if(!(howto & RB_POWEROFF) || poweroff_delay <= 0) 571 return; 572 DELAY(poweroff_delay * 1000); 573} | 56#include <sys/mount.h> 57#include <sys/queue.h> 58#include <sys/sysctl.h> 59#include <sys/conf.h> 60#include <sys/sysproto.h> 61#include <sys/cons.h> 62 63#include <machine/pcb.h> --- 503 unchanged lines hidden (view full) --- 567 568static void 569poweroff_wait(void *junk, int howto) 570{ 571 if(!(howto & RB_POWEROFF) || poweroff_delay <= 0) 572 return; 573 DELAY(poweroff_delay * 1000); 574} |
575 576/* 577 * Some system processes (e.g. syncer) need to be stopped at appropriate 578 * points in their main loops prior to a system shutdown, so that they 579 * won't interfere with the shutdown process (e.g. by holding a disk buf 580 * to cause sync to fail). For each of these system processes, register 581 * shutdown_kproc() as a handler for one of shutdown events. 582 */ 583static int kproc_shutdown_wait = 60; 584SYSCTL_INT(_kern_shutdown, OID_AUTO, kproc_shutdown_wait, CTLFLAG_RW, 585 &kproc_shutdown_wait, 0, ""); 586 587void 588shutdown_kproc(void *arg, int howto) 589{ 590 struct proc *p; 591 int error; 592 593 if (panicstr) 594 return; 595 596 p = (struct proc *)arg; 597 printf("Waiting (max %d seconds) for system process `%s' to stop...", 598 kproc_shutdown_wait * hz, p->p_comm); 599 error = suspend_kproc(p, kproc_shutdown_wait); 600 601 if (error == EWOULDBLOCK) 602 printf("timed out\n"); 603 else 604 printf("stopped\n"); 605} |
|