lkml.org 
[lkml]   [2000]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectFix for include/linux/string.h
Hello!

Some programs (namely GNU GRUB) don't compile with linux-2.4.0-test5. It
turns out that the following two-liner can only be compiled without
optimization:

================
#include <string.h>
#include <linux/fs.h>
================

Indeed, if we look into /usr/include/bits/string.h (glibc-2.1.3, i386) we
can see that some string functions (notably strpbrk) expand to hairy
macros when __OPTIMIZATION__ is enabled.

I don't want to argue whether it is good or bad, but the fact is that
GLIBC doesn't tolerate redeclarations of some functions.

I must admit that the kernel is wrong here. It declares functions
available exclusively to the kernel code even if __KERNEL__ is not
defined.

The following patch is proposed. More radical solutions (i.e. widening the
area surrounded by ifdef..endif) are left to the exersize for more radical
developers :-)

==================
--- linux.orig/include/linux/string.h Sun Jul 30 19:40:56 2000
+++ linux/include/linux/string.h Sun Jul 30 23:45:50 2000
@@ -8,11 +8,13 @@
extern "C" {
#endif

+#ifdef __KERNEL__
extern char * ___strtok;
extern char * strpbrk(const char *,const char *);
extern char * strtok(char *,const char *);
extern char * strsep(char **,const char *);
extern __kernel_size_t strspn(const char *,const char *);
+#endif


/*
==================
Regards,
Pavel Roskin


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

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.032 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site