* Console Drivers Rebooting
@ 2003-04-10 0:19 Bijoy Thomas
0 siblings, 0 replies; only message in thread
From: Bijoy Thomas @ 2003-04-10 0:19 UTC (permalink / raw)
To: Linux Kernel List
Hi guys!!!
This is my first mail to ts list and i'm eagerly awaiting a
reply. I was goin thru the printk source and found out that pritk was
calling the write method of struct console 's present on a list
pointed to by console_drivers. So I thot of adding my own console
driver like this....
#define MODULE
#define __KERNEL__
#include<linux/module.h>
#include<linux/kernel.h>
#include<linux/console.h>
#include<linux/sched.h>
void my_write(struct console *co,const char *buf,unsigned count)
{
struct tty_struct *my_tty;
my_tty = current->tty;
if(my_tty != NULL)
{
((my_tty->driver).write)(my_tty,0,buf,strlen(buf));
}
}
struct console my_console = {
name:"MYCON",
write:my_write,
flags:CON_ENABLED,
index:-1,
};
int init_module()
{
register_console(&my_console);
return 0;
}
void cleanup_module()
{
}
When I insmoded the module (in run level 3) it worked fine. While it
was still inserted i typed 'startx' and when i pressed 'Enter' ,the
machine instantly rebooted!!! I tried this again and it happened. With
MYCON registered ,if I issue the startx command ,the machine reboots.
Also if MYCON is registered and I shutdown using 'init 0' again the reboot
happens.Can anyone explain??
bye
Bijoy Jacob Thomas
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-04-10 0:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-10 0:19 Console Drivers Rebooting Bijoy Thomas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.