* Redefinition error while compiling LKM
@ 2005-12-29 10:51 pretorious .
2005-12-29 11:00 ` Al Viro
2005-12-29 11:02 ` Arjan van de Ven
0 siblings, 2 replies; 8+ messages in thread
From: pretorious . @ 2005-12-29 10:51 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Redefinition error while compiling LKM
2005-12-29 10:51 Redefinition error while compiling LKM pretorious .
@ 2005-12-29 11:00 ` Al Viro
2005-12-29 11:02 ` Arjan van de Ven
1 sibling, 0 replies; 8+ messages in thread
From: Al Viro @ 2005-12-29 11:00 UTC (permalink / raw)
To: pretorious .; +Cc: linux-kernel
On Thu, Dec 29, 2005 at 04:21:49PM +0530, pretorious . wrote:
> hi!
> I am facing problem in compiling an LKM. It seems Inclusion of
> <sys/stat.h> conflicts with definitions in time.h.
That's because you do not use libc headers for non-userland code...
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Redefinition error while compiling LKM
2005-12-29 10:51 Redefinition error while compiling LKM pretorious .
2005-12-29 11:00 ` Al Viro
@ 2005-12-29 11:02 ` Arjan van de Ven
2005-12-29 11:21 ` pretorious .
1 sibling, 1 reply; 8+ messages in thread
From: Arjan van de Ven @ 2005-12-29 11:02 UTC (permalink / raw)
To: pretorious .; +Cc: linux-kernel
On Thu, 2005-12-29 at 16:21 +0530, pretorious . wrote:
> 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
this is broken btw
>
> #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>
you cannot use glibc headers in kernel modules. anything in sys/ is a
glibc header.
and.. why on earth would you need sys/syscall.h ?? (or sys/stat.h for
that matter)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Redefinition error while compiling LKM
2005-12-29 11:02 ` Arjan van de Ven
@ 2005-12-29 11:21 ` pretorious .
2005-12-29 11:46 ` Alexander Shishckin
2005-12-29 11:49 ` Arjan van de Ven
0 siblings, 2 replies; 8+ messages in thread
From: pretorious . @ 2005-12-29 11:21 UTC (permalink / raw)
To: arjan; +Cc: linux-kernel
>
>and.. why on earth would you need sys/syscall.h ?? (or sys/stat.h for
>that matter)
>
>
Trying to override certain syscalls (mknod ...)
>From: Arjan van de Ven <arjan@infradead.org>
>To: "pretorious ." <pretorious_i@hotmail.com>
>CC: linux-kernel@vger.kernel.org
>Subject: Re: Redefinition error while compiling LKM
>Date: Thu, 29 Dec 2005 12:02:09 +0100
>
>On Thu, 2005-12-29 at 16:21 +0530, pretorious . wrote:
> > 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
>
>this is broken btw
> >
> > #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>
>
>
>you cannot use glibc headers in kernel modules. anything in sys/ is a
>glibc header.
>
>and.. why on earth would you need sys/syscall.h ?? (or sys/stat.h for
>that matter)
>
>
_________________________________________________________________
Spice up your IM conversations. New, colorful and animated emoticons. Get
chatting! http://server1.msn.co.in/SP05/emoticons/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Redefinition error while compiling LKM
2005-12-29 11:21 ` pretorious .
@ 2005-12-29 11:46 ` Alexander Shishckin
2005-12-29 11:49 ` Arjan van de Ven
1 sibling, 0 replies; 8+ messages in thread
From: Alexander Shishckin @ 2005-12-29 11:46 UTC (permalink / raw)
To: pretorious .; +Cc: linux-kernel
On 12/29/05, pretorious . <pretorious_i@hotmail.com> wrote:
> >
> >and.. why on earth would you need sys/syscall.h ?? (or sys/stat.h for
> >that matter)
> >
> >
>
> Trying to override certain syscalls (mknod ...)
You do not intercept syscalls.
You do not intercept syscalls from a kernel module.
You do not include libc headers in the kernel code.
--
I am free of all prejudices. I hate every one equally.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Redefinition error while compiling LKM
2005-12-29 11:21 ` pretorious .
2005-12-29 11:46 ` Alexander Shishckin
@ 2005-12-29 11:49 ` Arjan van de Ven
2005-12-29 12:14 ` Alexander Shishckin
1 sibling, 1 reply; 8+ messages in thread
From: Arjan van de Ven @ 2005-12-29 11:49 UTC (permalink / raw)
To: pretorious .; +Cc: linux-kernel
On Thu, 2005-12-29 at 16:51 +0530, pretorious . wrote:
> >
> >and.. why on earth would you need sys/syscall.h ?? (or sys/stat.h for
> >that matter)
> >
> >
>
> Trying to override certain syscalls (mknod ...)
eeppp why??
really don't do that!
(overriding syscalls from modules really shouldn't be done.. there's a
reason the syscall table isn't exported!)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Redefinition error while compiling LKM
2005-12-29 11:49 ` Arjan van de Ven
@ 2005-12-29 12:14 ` Alexander Shishckin
2005-12-29 12:16 ` Arjan van de Ven
0 siblings, 1 reply; 8+ messages in thread
From: Alexander Shishckin @ 2005-12-29 12:14 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: pretorious ., linux-kernel
On 12/29/05, Arjan van de Ven <arjan@infradead.org> wrote:
> On Thu, 2005-12-29 at 16:51 +0530, pretorious . wrote:
> > >
> > >and.. why on earth would you need sys/syscall.h ?? (or sys/stat.h for
> > >that matter)
> > >
> > >
> >
> > Trying to override certain syscalls (mknod ...)
>
> eeppp why??
> really don't do that!
>
> (overriding syscalls from modules really shouldn't be done.. there's a
> reason the syscall table isn't exported!)
Perhaps during the 2.4.21 old days sys_call_table was still exported
and there were plenty of 'How to intrecept a syscall in 10 minutes'
documents in the wild.
--
I am free of all prejudices. I hate every one equally.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Redefinition error while compiling LKM
2005-12-29 12:14 ` Alexander Shishckin
@ 2005-12-29 12:16 ` Arjan van de Ven
0 siblings, 0 replies; 8+ messages in thread
From: Arjan van de Ven @ 2005-12-29 12:16 UTC (permalink / raw)
To: Alexander Shishckin; +Cc: pretorious ., linux-kernel
On Thu, 2005-12-29 at 15:14 +0300, Alexander Shishckin wrote:
> On 12/29/05, Arjan van de Ven <arjan@infradead.org> wrote:
> > On Thu, 2005-12-29 at 16:51 +0530, pretorious . wrote:
> > > >
> > > >and.. why on earth would you need sys/syscall.h ?? (or sys/stat.h for
> > > >that matter)
> > > >
> > > >
> > >
> > > Trying to override certain syscalls (mknod ...)
> >
> > eeppp why??
> > really don't do that!
> >
> > (overriding syscalls from modules really shouldn't be done.. there's a
> > reason the syscall table isn't exported!)
>
> Perhaps during the 2.4.21 old days sys_call_table was still exported
not in the RHEL3 kernel though.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-12-29 12:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-29 10:51 Redefinition error while compiling LKM pretorious .
2005-12-29 11:00 ` Al Viro
2005-12-29 11:02 ` Arjan van de Ven
2005-12-29 11:21 ` pretorious .
2005-12-29 11:46 ` Alexander Shishckin
2005-12-29 11:49 ` Arjan van de Ven
2005-12-29 12:14 ` Alexander Shishckin
2005-12-29 12:16 ` Arjan van de Ven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®