kern_shutdown.c (74890) | kern_shutdown.c (75570) |
---|---|
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 74890 2001-03-28 01:37:29Z ps $ | 39 * $FreeBSD: head/sys/kern/kern_shutdown.c 75570 2001-04-17 04:18:08Z jhb $ |
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> --- 495 unchanged lines hidden (view full) --- 543 if ((c = cncheckc()) == 0x03) 544 return -1; 545 else if (c != -1) 546 printf("[CTRL-C to abort] "); 547 548 return 0; 549} 550 | 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> --- 495 unchanged lines hidden (view full) --- 543 if ((c = cncheckc()) == 0x03) 544 return -1; 545 else if (c != -1) 546 printf("[CTRL-C to abort] "); 547 548 return 0; 549} 550 |
551#ifdef SMP 552static u_int panic_cpu = NOCPU; 553#endif 554 |
|
551/* 552 * Panic is called on unresolvable fatal errors. It prints "panic: mesg", 553 * and then reboots. If we are called twice, then we avoid trying to sync 554 * the disks as this often leads to recursive panics. 555 */ 556void 557panic(const char *fmt, ...) 558{ 559 int bootopt; 560 va_list ap; 561 static char buf[256]; 562 563#ifdef SMP 564 /* Only 1 CPU can panic at a time */ | 555/* 556 * Panic is called on unresolvable fatal errors. It prints "panic: mesg", 557 * and then reboots. If we are called twice, then we avoid trying to sync 558 * the disks as this often leads to recursive panics. 559 */ 560void 561panic(const char *fmt, ...) 562{ 563 int bootopt; 564 va_list ap; 565 static char buf[256]; 566 567#ifdef SMP 568 /* Only 1 CPU can panic at a time */ |
565 mtx_lock(&panic_mtx); | 569 if (panic_cpu != PCPU_GET(cpuid) && 570 atomic_cmpset_int(&panic_cpu, NOCPU, PCPU_GET(cpuid)) == 0) { 571 for (;;) 572 ; /* nothing */ 573 } |
566#endif 567 568 bootopt = RB_AUTOBOOT | RB_DUMP; 569 if (panicstr) 570 bootopt |= RB_NOSYNC; 571 else 572 panicstr = fmt; 573 --- 70 unchanged lines hidden --- | 574#endif 575 576 bootopt = RB_AUTOBOOT | RB_DUMP; 577 if (panicstr) 578 bootopt |= RB_NOSYNC; 579 else 580 panicstr = fmt; 581 --- 70 unchanged lines hidden --- |