public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bijoy Thomas <bijoys_2000@rediffmail.com>
To: Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Console Drivers Rebooting
Date: Thu, 10 Apr 2003 05:49:54 +0530	[thread overview]
Message-ID: <004601c2fef8$59cdcfc0$23ed013d@bijoy> (raw)

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


                 reply	other threads:[~2003-04-10  0:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='004601c2fef8$59cdcfc0$23ed013d@bijoy' \
    --to=bijoys_2000@rediffmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox