Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3351
b: refs/heads/master
c: 86b1ae3
h: refs/heads/master
i:
  3349: ee7a1dc
  3347: a143689
  3343: 5067986
v: v3
  • Loading branch information
Hariprasad Nellitheertha authored and Linus Torvalds committed Jun 25, 2005
1 parent 6a8d624 commit 402ddda
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 315c215c0a7324894541d43b0e720f20cafca92e
refs/heads/master: 86b1ae38c0a62409dc862a28e3f08920f55f944b
5 changes: 5 additions & 0 deletions trunk/Documentation/sysrq.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ On all - write a character to /proc/sysrq-trigger. eg:
'b' - Will immediately reboot the system without syncing or unmounting
your disks.

'c' - Will perform a kexec reboot in order to take a crashdump.

'o' - Will shut your system off (if configured and supported).

's' - Will attempt to sync all mounted filesystems.
Expand Down Expand Up @@ -122,6 +124,9 @@ useful when you want to exit a program that will not let you switch consoles.
re'B'oot is good when you're unable to shut down. But you should also 'S'ync
and 'U'mount first.

'C'rashdump can be used to manually trigger a crashdump when the system is hung.
The kernel needs to have been built with CONFIG_KEXEC enabled.

'S'ync is great when your system is locked up, it allows you to sync your
disks and will certainly lessen the chance of data loss and fscking. Note
that the sync hasn't taken place until you see the "OK" and "Done" appear
Expand Down
24 changes: 22 additions & 2 deletions trunk/drivers/char/sysrq.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <linux/spinlock.h>
#include <linux/vt_kern.h>
#include <linux/workqueue.h>
#include <linux/kexec.h>

#include <asm/ptrace.h>

Expand Down Expand Up @@ -94,6 +95,21 @@ static struct sysrq_key_op sysrq_unraw_op = {
};
#endif /* CONFIG_VT */

#ifdef CONFIG_KEXEC
/* crashdump sysrq handler */
static void sysrq_handle_crashdump(int key, struct pt_regs *pt_regs,
struct tty_struct *tty)
{
crash_kexec();
}
static struct sysrq_key_op sysrq_crashdump_op = {
.handler = sysrq_handle_crashdump,
.help_msg = "Crashdump",
.action_msg = "Trigger a crashdump",
.enable_mask = SYSRQ_ENABLE_DUMP,
};
#endif

/* reboot sysrq handler */
static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs,
struct tty_struct *tty)
Expand Down Expand Up @@ -273,8 +289,12 @@ static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
it is handled specially on the sparc
and will never arrive */
/* b */ &sysrq_reboot_op,
/* c */ NULL,
/* d */ NULL,
#ifdef CONFIG_KEXEC
/* c */ &sysrq_crashdump_op,
#else
/* c */ NULL,
#endif
/* d */ NULL,
/* e */ &sysrq_term_op,
/* f */ &sysrq_moom_op,
/* g */ NULL,
Expand Down

0 comments on commit 402ddda

Please sign in to comment.