Re: linux/module.h does not exist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

      I was just trying u r code,just wrote makefile it compliled  and got .ko file but there was  sys_table was undefined which was pointed earlier by
some people on mailing list,Please ignore me if i am wrong


make -C /lib/modules/2.6.27.25-78.2.56.fc9.i686/build M=/home/praval/cprog/lkm/misc modules
make[1]: Entering directory `/usr/src/kernels/2.6.27.25-78.2.56.fc9.i686'
Building with KERNELRELEASE = 2.6.27.25-78.2.56.fc9.i686
  CC [M]  /home/praval/cprog/lkm/misc/tapas.o
/home/praval/cprog/lkm/misc/tapas.c: In function ‘init_module’:
/home/praval/cprog/lkm/misc/tapas.c:20: warning: no return statement in function returning non-void
  Building modules, stage 2.
Building with KERNELRELEASE = 2.6.27.25-78.2.56.fc9.i686
  MODPOST 1 modules
WARNING: "sys_table" [/home/praval/cprog/lkm/misc/tapas.ko] undefined!
  CC      /home/praval/cprog/lkm/misc/tapas.mod.o
  LD [M]  /home/praval/cprog/lkm/misc/tapas.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.27.25-78.2.56.fc9.i686'



it is

#include <asm/syscall.h>
not
#include <asm/syscalls.h>






--- On Mon, 23/8/10, Tapas Mishra <mightydreams@xxxxxxxxx> wrote:

From: Tapas Mishra <mightydreams@xxxxxxxxx>
Subject: Re: linux/module.h does not exist
To: "SPK" <sharad.katti@xxxxxxxxx>
Cc: kernelnewbies@xxxxxxxxxxxx
Date: Monday, 23 August, 2010, 9:59 PM

No It did not worked I tried what you said.
Here is the new program.
If possible just copy paste the program and try to run.

#include <linux/kernel.h>
#include <asm/syscalls.h>
#include <linux/module.h>
#include <linux/unistd.h>
extern void *sys_table[];
asmlinkage int(*main_sys_exit)(int);
asmlinkage int alt_exit_function(int err_code)
{
        printk("Sys_exit called with err_code=%d\n",err_code);
        return main_sys_exit(err_code);
}

int init_module()
{
        main_sys_exit=sys_table[__NR_exit];
        sys_table[__NR_exit]=alt_exit_function;
}
void cleanup_module()
{
        sys_table[__NR_exit]=main_sys_exit;
}


Following way I tried to do it.

gcc -I /usr/src/linux-headers-`uname -r`/include -I
/usr/src/linux-headers-`uname -r`/linux -Wall -DMODULE -D__KERNEL__
-DLINUX -c sample2.c

and following errors I got

http://pastebin.com/ZGRD8cC3
any more guess?

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux