- 论坛徽章:
- 0
|
sysrq提供了查看进程调用栈等功能,对于开发人员来说具有一定的实用意义。
文档:/Documentation/sysrq.txt有该功能使用的详细说明。1. 使能sysrqecho 1 >/proc/sys/kernel/sysrq 2. 打印出需要的信息echo key >/proc/sysrq-trigger其中的key对应了需要使用的功能,比如:'b' - Will immediately reboot the system without syncing or unmounting your disks.'c' - Will perform a kexec reboot in order to take a crashdump.'d' - Shows all locks that are held.'e' - Send a SIGTERM to all processes, except for init.'f' - Will call oom_kill to kill a memory hog process.'g' - Used by kgdb on ppc and sh platforms.'h' - Will display help (actually any other key than those listed here will display help. but 'h' is easy to remember :-)'i' - Send a SIGKILL to all processes, except for init.'k' - Secure Access Key (SAK) Kills all programs on the current virtual console. NOTE: See important comments below in SAK section.'l' - Shows a stack backtrace for all active CPUs.'m' - Will dump current memory info to your console.'n' - Used to make RT tasks nice-able'o' - Will shut your system off (if configured and supported).'p' - Will dump the current registers and flags to your console.'q' - Will dump a list of all running timers.'r' - Turns off keyboard raw mode and sets it to XLATE.'s' - Will attempt to sync all mounted filesystems.'t' - Will dump a list of current tasks and their information to your console.'u' - Will attempt to remount all mounted filesystems read-only.'v' - Dumps Voyager SMP processor info to your console.'w' - Dumps tasks that are in uninterruptable (blocked) state.'x' - Used by xmon interface on ppc/powerpc platforms.'0'-'9' - Sets the console log level, controlling which kernel messages will be printed to your console. ('0', for example would make it so that only emergency messages like PANICs or OOPSes would make it to your console.)。3 举例echo t >/proc/sysrq-triggerlogin S c0211da1 0 849 1 c1929eb8 00000086 c021282c c0211da1 c18850e0 c1885234 c1048480 00000000 c18638c0 c1929e9c c0116721 c1929edc c0151572 00000056 b7f75000 b7f71000 c18638c0 00000000 7fffffff c196ac00 00000000 c1929ef8 c02acbb5 c19590b0 Call Trace: [] ? vt_ioctl+0x0/0x1538 [] ? n_tty_ioctl+0x0/0x1e7 [] ? kmap_atomic_prot+0x94/0x99 [] ? vma_adjust+0x1a4/0x350 [] schedule_timeout+0x16/0x8b [] ? copy_to_user+0x33/0x3f [] ? add_wait_queue+0x30/0x38 [] read_chan+0x340/0x585 [] ? mmap_region+0x121/0x380 [] ? default_wake_function+0x0/0xd [] ? read_chan+0x0/0x585 [] tty_read+0x5a/0x95 [] ? tty_read+0x0/0x95 [] vfs_read+0x6d/0x91 [] sys_read+0x3b/0x60 [] sysenter_past_esp+0x6a/0x91 =======================
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/63018/showart_1148627.html |
|