Deleted Added
full compact
kern_shutdown.c (132171) kern_shutdown.c (132177)
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 132171 2004-07-15 03:20:08Z njl $");
38__FBSDID("$FreeBSD: head/sys/kern/kern_shutdown.c 132177 2004-07-15 04:29:48Z alfred $");
39
40#include "opt_kdb.h"
41#include "opt_hw_wdog.h"
42#include "opt_mac.h"
43#include "opt_panic.h"
44#include "opt_show_busybufs.h"
45
46#include <sys/param.h>

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

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.
244 */
245static void
246boot(int howto)
247{
39
40#include "opt_kdb.h"
41#include "opt_hw_wdog.h"
42#include "opt_mac.h"
43#include "opt_panic.h"
44#include "opt_show_busybufs.h"
45
46#include <sys/param.h>

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

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.
244 */
245static void
246boot(int howto)
247{
248 int first_buf_printf;
248
249
250 first_buf_printf = 1;
251
249 /* collect extra flags that shutdown_nice might have set */
250 howto |= shutdown_howto;
251
252 /* We are out of the debugger now. */
253 kdb_active = 0;
254
255#ifdef SMP
256 if (smp_active)

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

267 if (!cold && (howto & RB_NOSYNC) == 0 && waittime < 0) {
268 register struct buf *bp;
269 int iter, nbusy, pbusy;
270#ifndef PREEMPTION
271 int subiter;
272#endif
273
274 waittime = 0;
252 /* collect extra flags that shutdown_nice might have set */
253 howto |= shutdown_howto;
254
255 /* We are out of the debugger now. */
256 kdb_active = 0;
257
258#ifdef SMP
259 if (smp_active)

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

270 if (!cold && (howto & RB_NOSYNC) == 0 && waittime < 0) {
271 register struct buf *bp;
272 int iter, nbusy, pbusy;
273#ifndef PREEMPTION
274 int subiter;
275#endif
276
277 waittime = 0;
275 printf("syncing disks, buffers remaining... ");
276
277 sync(&thread0, NULL);
278
279 /*
280 * With soft updates, some buffers that are
281 * written will be remarked as dirty until other
282 * buffers are written.
283 */

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

290 } else if ((bp->b_flags & (B_DELWRI | B_INVAL))
291 == B_DELWRI) {
292 /* bawrite(bp);*/
293 nbusy++;
294 }
295 }
296 if (nbusy == 0)
297 break;
278
279 sync(&thread0, NULL);
280
281 /*
282 * With soft updates, some buffers that are
283 * written will be remarked as dirty until other
284 * buffers are written.
285 */

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

292 } else if ((bp->b_flags & (B_DELWRI | B_INVAL))
293 == B_DELWRI) {
294 /* bawrite(bp);*/
295 nbusy++;
296 }
297 }
298 if (nbusy == 0)
299 break;
300 if (first_buf_printf) {
301 printf("syncing disks, buffers remaining... ");
302 first_buf_printf = 0;
303 }
298 printf("%d ", nbusy);
299 if (nbusy < pbusy)
300 iter = 0;
301 pbusy = nbusy;
302 sync(&thread0, NULL);
303
304#ifdef PREEMPTION
305 /*

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

571static int kproc_shutdown_wait = 60;
572SYSCTL_INT(_kern_shutdown, OID_AUTO, kproc_shutdown_wait, CTLFLAG_RW,
573 &kproc_shutdown_wait, 0, "");
574
575void
576kproc_shutdown(void *arg, int howto)
577{
578 struct proc *p;
304 printf("%d ", nbusy);
305 if (nbusy < pbusy)
306 iter = 0;
307 pbusy = nbusy;
308 sync(&thread0, NULL);
309
310#ifdef PREEMPTION
311 /*

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

577static int kproc_shutdown_wait = 60;
578SYSCTL_INT(_kern_shutdown, OID_AUTO, kproc_shutdown_wait, CTLFLAG_RW,
579 &kproc_shutdown_wait, 0, "");
580
581void
582kproc_shutdown(void *arg, int howto)
583{
584 struct proc *p;
585 char procname[MAXCOMLEN + 1];
579 int error;
580
581 if (panicstr)
582 return;
583
584 p = (struct proc *)arg;
586 int error;
587
588 if (panicstr)
589 return;
590
591 p = (struct proc *)arg;
585 printf("Waiting (max %d seconds) for system process `%s' to stop...",
586 kproc_shutdown_wait, p->p_comm);
592 strlcpy(procname, p->p_comm, sizeof(procname));
593 printf("Waiting (max %d seconds) for system process `%s' to stop...\n",
594 kproc_shutdown_wait, procname);
587 error = kthread_suspend(p, kproc_shutdown_wait * hz);
588
589 if (error == EWOULDBLOCK)
595 error = kthread_suspend(p, kproc_shutdown_wait * hz);
596
597 if (error == EWOULDBLOCK)
590 printf("timed out\n");
598 printf("Stop of '%s' timed out\n", procname);
591 else
599 else
592 printf("stopped\n");
600 printf("Process '%s' stopped\n", procname);
593}
594
595/* Registration of dumpers */
596int
597set_dumper(struct dumperinfo *di)
598{
599
600 if (di == NULL) {

--- 17 unchanged lines hidden ---
601}
602
603/* Registration of dumpers */
604int
605set_dumper(struct dumperinfo *di)
606{
607
608 if (di == NULL) {

--- 17 unchanged lines hidden ---