Skip to contentSkip to conversation

Fix for include/linux/fs.h in 2.4.0 kernels

DISCUSSION Jocelyn Mayer 3 participants 3 messages Feb 2, 2001 – Feb 3, 2001

lore
Share & tools
lore
#0 lore raw

I had some problems while compiling some applications with the 2.4.0 kernel.
The problem was a conflict between string.h from the libc and the one from the kernel, which is included in fs.h So, using <string.h> and <linux/fs.h> at the same time brings some conflicts.
It seems to me that <linux/string.h> should not be apparent from user mode, so I did this patch:

--- fs.h-orig Fri Feb 2 23:55:35
2001
+++ fs.h Fri Feb 2 21:26:05
2001
@@ -20,7 +20,7
@@
#include
<linux/stat.h>
#include
<linux/cache.h>
#include
<linux/stddef.h>
-#include
<linux/string.h>
+/* #include <linux/string.h>
*/

#include
<asm/atomic.h>
#include
<asm/bitops.h>
@@ -190,6 +190,7
@@

#include
<asm/semaphore.h>
#include
<asm/byteorder.h>
+#include
<linux/string.h>

extern void update_atime (struct inode
*);
#define UPDATE_ATIME(inode) update_atime
(inode)

Like this, the #include <linux/string.h> is "protected" by a #ifdef __KERNEL__, so I don't have any conflict any more.

I recompiled my kernel without any problem since I did that patch.

Regards.

Jocelyn Mayer.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 4 lines · Jocelyn Mayer

I had some problems while compiling some applications with the 2.4.0 kernel.
The problem was a conflict between string.h from the libc and the one from the kernel, which is included in fs.h

Rule 1. Applications must not include include kernel headers directly.

Rule 2. Any glibc that has a symlink from /usr/include/{linux,asm} to /usr/src/linux/include/{linux,asm} is wrong.

Relying on /usr/include/{linux,asm} always pointing at the current kernel source is broken as designed. /usr/include/{linux,asm} must be real directories that are shipped as part of glibc, not symlinks to some random version of the kernel. Fix /usr/include.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
Quoted 3 lines

kernel source is broken as designed. /usr/include/{linux,asm} must be real directories that are shipped as part of glibc, not symlinks to some random version of the kernel. Fix /usr/include.

You need to fix the kernel headers too - libc5 doesnt work otherwise -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/