Linux 2.1 kernel patch to clean up header files

tytso@mit.edu
Mon, 25 May 1998 00:23:02 -0400


Hi Linus,

Could you please apply this patch to your kernel sources? It
#ifdef's out certain kernel header definitions only when these header
files are included in user-level programs using glibc. It makes no
difference to kernel compiles, or to folks using libc 5. It only
removes a number of duplicate definition warnings caused by having these
header include files duplicate definitions already made by libc's header
files.

Most programs don't notice this problem, but e2fsprogs most
definitely does have this issue.

Thanks!!

- Ted

P.S. I've sent this patch to you before, but you've declined to include
it. If you don't like this patch for some reason, could you please let
me know why? Thanks!!

Patch generated: on Sun May 24 14:09:09 EDT 1998 by tytso@rsts-11.mit.edu
against Linux version 2.1.103

===================================================================
RCS file: include/asm-i386/RCS/posix_types.h,v
retrieving revision 1.1
diff -u -r1.1 include/asm-i386/posix_types.h
--- include/asm-i386/posix_types.h 1998/05/24 18:08:15 1.1
+++ include/asm-i386/posix_types.h 1998/05/24 18:08:37
@@ -37,6 +37,8 @@
#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
} __kernel_fsid_t;

+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
#undef __FD_SET
#define __FD_SET(fd,fdsetp) \
__asm__ __volatile__("btsl %1,%0": \
@@ -61,5 +63,7 @@
:"=m" (*(__kernel_fd_set *) (fdsetp)) \
:"a" (0), "c" (__FDSET_LONGS), \
"D" ((__kernel_fd_set *) (fdsetp)) :"cx","di")
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */

#endif
===================================================================
RCS file: include/linux/RCS/stat.h,v
retrieving revision 1.1
diff -u -r1.1 include/linux/stat.h
--- include/linux/stat.h 1998/05/24 18:08:15 1.1
+++ include/linux/stat.h 1998/05/24 18:08:37
@@ -7,6 +7,8 @@

#endif

+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
#define S_IFMT 00170000
#define S_IFSOCK 0140000
#define S_IFLNK 0120000
@@ -41,6 +43,8 @@
#define S_IROTH 00004
#define S_IWOTH 00002
#define S_IXOTH 00001
+
+#endif

#ifdef __KERNEL__
#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
===================================================================
RCS file: include/linux/RCS/socket.h,v
retrieving revision 1.1
diff -u -r1.1 include/linux/socket.h
--- include/linux/socket.h 1998/05/24 18:08:15 1.1
+++ include/linux/socket.h 1998/05/24 18:08:37
@@ -1,6 +1,8 @@
#ifndef _LINUX_SOCKET_H
#define _LINUX_SOCKET_H

+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
#include <asm/socket.h> /* arch-dependent defines */
#include <linux/sockios.h> /* the SIOCxxx I/O controls */
#include <linux/uio.h> /* iovec support */
@@ -256,4 +258,5 @@
extern int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr);
extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
#endif
+#endif /* not kernel and not glibc */
#endif /* _LINUX_SOCKET_H */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu