[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] Problems with kernel modules



Hi there,
Just yesteerday I wrote a module and compiled without any hassles and then
inserted that
and remove that module also without hassles ;-) ( but a small panic ;-)

here is my program ( warning: Please do not try this at home ;-) and some
usual disclaimers !!

#include <linux/module.h>
#include <linux/kernel.h>

init init_module( void)
{
     printk( "Loading the panic module 3.....2......1.....\n");
     printk(" Done !! \n");
     return(0);
}

void cleanup_module(void)
{
     char *ch=0;
     printk(" Your Module is ready to panic 3.....2.......1\n ");
     *ch='a';
}

and then I did
$ gcc -D__KERNEL -DMODULE -I/usr/include panic.c

and then

$ insmod panic.o
$ rmmod panic

and my system happily panic'ed ;-)

Well, we were testing something for which we had to write this module. ;-)
So change this to suit your thing ;-)
HTH
     Khader

----------------------------------   @}--------
Syed Khader Vali                  Debian 2.2.1 ( potato )
skhader@xxxxxxxxxx             Kernel 2.3.33
# 91-80-5262355                Extn:2527


--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.