lkml.org 
[lkml]   [2008]   [May]   [12]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectDoes sysrq break something?
FromTetsuo Handa <>
DateMon, 12 May 2008 21:16:30 +0900
Hello.

I'm trying to get a sysrq dump when the system hangs.
But unfortunately, typing sysrq key from the keyboard
doesn't work after the system hangs.
So, I'm trying to get a sysrq dump by automatically
writing to /proc/sysrq-trigger using a program.

  #include <stdio.h>
  #include <unistd.h>

  int main(int argc, char *argv[]) {
  	FILE *fp = fopen("/proc/sys/kernel/sysrq", "w");
  	if (!fp) return 1;
  	fprintf(fp, "1\n");
  	fclose(fp);
  	fp = fopen("/proc/sysrq-trigger", "w");
  	if (!fp) return 1;
  	while (1) {
  		sleep(60);
  		fprintf(fp, "t\n");
  		fflush(fp);
  	}
  	return 0;
  }
Is running this program safe?

In other words, does invoking sysrq routine break or taint something?

Regards.


\
 
 \ /
  Last update: 2008-05-12 14:19    [from the cache]
©2003-2008