[Initng-svn] r3691 - initng/trunk/src
svn at initng.thinktux.net
svn at initng.thinktux.net
Wed Apr 5 22:35:37 CEST 2006
Author: jimmy
Date: Wed Apr 5 22:35:36 2006
New Revision: 3691
Modified:
initng/trunk/src/initng_main.c
Log:
Now if compiled with #debug a segfault makes initng launch manually a getty on tty9 to login to and run gdb from, this is good if initng
segfaults before a terminal is launched, or after all is terminated.
Modified: initng/trunk/src/initng_main.c
==============================================================================
--- initng/trunk/src/initng_main.c (original)
+++ initng/trunk/src/initng_main.c Wed Apr 5 22:35:36 2006
@@ -427,8 +427,20 @@
#ifdef DEBUG
#define MESSAGE "Initng segfaulted, will wait in 20 seconds for you to start a gdb, before execve(/sbin/initng-segfault);\n"
+
+ /* Try to launch a getty, that we may if lucky login to tty9 and run gdb there */
+ if(fork()==0)
+ {
+ const char *getty_argv[] = { "/sbin/getty", "38400", "tty9", NULL };
+ const char *getty_env[] = { NULL };
+
+ /* execve getty in the fork */
+ execve((char *) getty_argv[0], (char **) getty_argv, (char **) getty_env);
+ _exit(1);
+ }
+
/* if we compiled debug mode, we get the user 20 seconds to fire up gdb, and attach pid 1 */
- while(i<6)
+ while(i<5)
{
emergency_output = open("/dev/console", O_WRONLY);
if(emergency_output>0)
@@ -436,7 +448,7 @@
write(emergency_output, MESSAGE, sizeof(char) * strlen(MESSAGE));
close(emergency_output);
}
- sleep(4);
+ sleep(4); /* 5 times 4 is 20 seconds */
i++;
}
#endif
More information about the Initng-svn
mailing list