kern_shutdown.c (221173) | kern_shutdown.c (222801) |
---|---|
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 221173 2011-04-28 16:02:05Z attilio $"); | 38__FBSDID("$FreeBSD: head/sys/kern/kern_shutdown.c 222801 2011-06-07 01:28:12Z marcel $"); |
39 40#include "opt_ddb.h" 41#include "opt_kdb.h" 42#include "opt_panic.h" 43#include "opt_show_busybufs.h" 44#include "opt_sched.h" 45#include "opt_watchdog.h" 46 --- 181 unchanged lines hidden (view full) --- 228 if (f || ts.tv_sec >= 60) { 229 printf("%ldm", (long)ts.tv_sec / 60); 230 ts.tv_sec %= 60; 231 f = 1; 232 } 233 printf("%lds\n", (long)ts.tv_sec); 234} 235 | 39 40#include "opt_ddb.h" 41#include "opt_kdb.h" 42#include "opt_panic.h" 43#include "opt_show_busybufs.h" 44#include "opt_sched.h" 45#include "opt_watchdog.h" 46 --- 181 unchanged lines hidden (view full) --- 228 if (f || ts.tv_sec >= 60) { 229 printf("%ldm", (long)ts.tv_sec / 60); 230 ts.tv_sec %= 60; 231 f = 1; 232 } 233 printf("%lds\n", (long)ts.tv_sec); 234} 235 |
236static void 237doadump(void) | 236int 237doadump(boolean_t textdump) |
238{ | 238{ |
239 boolean_t coredump; |
|
239 | 240 |
240 /* 241 * Sometimes people have to call this from the kernel debugger. 242 * (if 'panic' can not dump) 243 * Give them a clue as to why they can't dump. 244 */ 245 if (dumper.dumper == NULL) { 246 printf("Cannot dump. Device not defined or unavailable.\n"); 247 return; 248 } | 241 if (dumping) 242 return (EBUSY); 243 if (dumper.dumper == NULL) 244 return (ENXIO); |
249 250 savectx(&dumppcb); 251 dumptid = curthread->td_tid; 252 dumping++; | 245 246 savectx(&dumppcb); 247 dumptid = curthread->td_tid; 248 dumping++; |
249 250 coredump = TRUE; |
|
253#ifdef DDB | 251#ifdef DDB |
254 if (textdump_pending) | 252 if (textdump && textdump_pending) { 253 coredump = FALSE; |
255 textdump_dumpsys(&dumper); | 254 textdump_dumpsys(&dumper); |
256 else | 255 } |
257#endif | 256#endif |
257 if (coredump) |
|
258 dumpsys(&dumper); | 258 dumpsys(&dumper); |
259 |
|
259 dumping--; | 260 dumping--; |
261 return (0); |
|
260} 261 262static int 263isbufbusy(struct buf *bp) 264{ 265 if (((bp->b_flags & (B_INVAL | B_PERSISTENT)) == 0 && 266 BUF_ISLOCKED(bp)) || 267 ((bp->b_flags & (B_DELWRI | B_INVAL)) == B_DELWRI)) --- 152 unchanged lines hidden (view full) --- 420 421 /* 422 * Ok, now do things that assume all filesystem activity has 423 * been completed. 424 */ 425 EVENTHANDLER_INVOKE(shutdown_post_sync, howto); 426 427 if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping) | 262} 263 264static int 265isbufbusy(struct buf *bp) 266{ 267 if (((bp->b_flags & (B_INVAL | B_PERSISTENT)) == 0 && 268 BUF_ISLOCKED(bp)) || 269 ((bp->b_flags & (B_DELWRI | B_INVAL)) == B_DELWRI)) --- 152 unchanged lines hidden (view full) --- 422 423 /* 424 * Ok, now do things that assume all filesystem activity has 425 * been completed. 426 */ 427 EVENTHANDLER_INVOKE(shutdown_post_sync, howto); 428 429 if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping) |
428 doadump(); | 430 doadump(TRUE); |
429 430 /* Now that we're going to really halt the system... */ 431 EVENTHANDLER_INVOKE(shutdown_final, howto); 432 433 for(;;) ; /* safety against shutdown_reset not working */ 434 /* NOTREACHED */ 435} 436 --- 290 unchanged lines hidden --- | 431 432 /* Now that we're going to really halt the system... */ 433 EVENTHANDLER_INVOKE(shutdown_final, howto); 434 435 for(;;) ; /* safety against shutdown_reset not working */ 436 /* NOTREACHED */ 437} 438 --- 290 unchanged lines hidden --- |