source: rtems-libbsd/rtemsbsd/src/rtems-bsd-panic.c @ 6ad03bf

4.1155-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since 6ad03bf was 6ad03bf, checked in by Joel Sherrill <joel.sherrill@…>, on 03/08/12 at 16:31:56

Remove rtems/ from includes of RTEMS specific files

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup rtems_bsd_rtems
5 *
6 * @brief TODO.
7 */
8
9/*
10 * Copyright (c) 2009, 2010 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.com/license/LICENSE.
21 */
22
23#include <freebsd/machine/rtems-bsd-config.h>
24
25#include <freebsd/sys/param.h>
26#include <freebsd/sys/types.h>
27#include <freebsd/sys/systm.h>
28#include <freebsd/sys/kernel.h>
29#include <freebsd/sys/lock.h>
30#include <freebsd/sys/mutex.h>
31#include <freebsd/sys/proc.h>
32
33static void
34suspend_all_threads(void)
35{
36        rtems_chain_control *chain = &rtems_bsd_thread_chain;
37        rtems_chain_node *node = rtems_chain_first(chain);
38        rtems_id self = rtems_task_self();
39
40        while (!rtems_chain_is_tail(chain, node)) {
41                struct thread *td = (struct thread *) node;
42
43                if (td->td_id != self && td->td_id != RTEMS_SELF) {
44                        rtems_task_suspend(td->td_id);
45                }
46
47                node = rtems_chain_next(node);
48        }
49
50        rtems_task_suspend(RTEMS_SELF);
51}
52
53void
54panic(const char *fmt, ...)
55{
56        va_list ap;
57
58        printf("*** BSD PANIC *** ");
59
60        va_start(ap, fmt);
61        vprintf(fmt, ap);
62        va_end(ap);
63
64        printf("\n");
65
66        suspend_all_threads();
67
68        /* FIXME */
69        rtems_fatal_error_occurred(0xdeadbeef);
70}
Note: See TracBrowser for help on using the repository browser.