Redefinition error while compiling LKM

From: pretorious .
Date: Thu Dec 29 2005 - 05:51:59 EST


hi!
I am facing problem in compiling an LKM. It seems Inclusion of <sys/stat.h> conflicts with definitions in time.h.


My linux kernal version is 2.4.21-4.EL


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

#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif

#ifndef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) ((a)*65536+(b)*256+(c))
#endif

#include <linux/slab.h>
#include <asm/uaccess.h>
#include <sys/syscall.h>

#include <sys/stat.h>

#define CALLOFF 500
MODULE_LICENSE("GPL");
......
......


Inclusion of header file "sys/stat.h" gives variable redefinition error during compilation.

........
In file included from /usr/include/sys/stat.h:37,
from venky.c:18:
/usr/include/time.h:119: redefinition of `struct timespec'
In file included from /usr/include/sys/stat.h:105,
from venky.c:18:
/usr/include/bits/stat.h:37: redefinition of `struct stat'
......


The Compile string is ::

gcc -O2 -DMODULE -D__KERNEL__ -W -Wall -Wstrict-prototypes -Wmissing-prototypes -isystem /lib/modules/`uname -r`/build/include -I../ -c -o test.o test.c

Similar redefinition error message are there when trying to include header files like sys/types.h

It would be very helpfull if someone would point me in right direction.

Thanks

_________________________________________________________________
Tuff to bluff! Get Abhishek before he gets you! Enter the contest http://utv.movie-talkies.com/bluffmaster/contest.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/