aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSimon Kagstrom <simon.kagstrom@netinsight.net>2009-10-16 08:09:18 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-11-30 07:01:49 -0500
commit456b565cc52fbcdaa2e19ffdf40d9dd3b726d603 (patch)
treec73029f31756289ed54183e97e0613f87cef6ed5 /include/linux
parent7cb777a3d71f9d1f7eb149c7a504d21f24219ae8 (diff)
core: Add kernel message dumper to call on oopses and panics
The core functionality is implemented as per Linus suggestion from http://lists.infradead.org/pipermail/linux-mtd/2009-October/027620.html (with the kmsg_dump implementation by Linus). A struct kmsg_dumper has been added which contains a callback to dump the kernel log buffers on crashes. The kmsg_dump function gets called from oops_exit() and panic() and invokes this callbacks with the crash reason. [dwmw2: Fix log_end handling] Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net> Reviewed-by: Anders Grafstrom <anders.grafstrom@netinsight.net> Reviewed-by: Linus Torvalds <torvalds@linux-foundation.org> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kmsg_dump.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
new file mode 100644
index 000000000000..7f089ec5ef32
--- /dev/null
+++ b/include/linux/kmsg_dump.h
@@ -0,0 +1,44 @@
1/*
2 * linux/include/kmsg_dump.h
3 *
4 * Copyright (C) 2009 Net Insight AB
5 *
6 * Author: Simon Kagstrom <simon.kagstrom@netinsight.net>
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive
10 * for more details.
11 */
12#ifndef _LINUX_KMSG_DUMP_H
13#define _LINUX_KMSG_DUMP_H
14
15#include <linux/list.h>
16
17enum kmsg_dump_reason {
18 KMSG_DUMP_OOPS,
19 KMSG_DUMP_PANIC,
20};
21
22/**
23 * struct kmsg_dumper - kernel crash message dumper structure
24 * @dump: The callback which gets called on crashes. The buffer is passed
25 * as two sections, where s1 (length l1) contains the older
26 * messages and s2 (length l2) contains the newer.
27 * @list: Entry in the dumper list (private)
28 * @registered: Flag that specifies if this is already registered
29 */
30struct kmsg_dumper {
31 void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason,
32 const char *s1, unsigned long l1,
33 const char *s2, unsigned long l2);
34 struct list_head list;
35 int registered;
36};
37
38void kmsg_dump(enum kmsg_dump_reason reason);
39
40int kmsg_dump_register(struct kmsg_dumper *dumper);
41
42int kmsg_dump_unregister(struct kmsg_dumper *dumper);
43
44#endif /* _LINUX_KMSG_DUMP_H */