Fixes to system header files

tytso@MIT.EDU
Thu, 16 Apr 1998 10:52:43 -0400


Hi Linus,

The following patches get rid of duplicate definition warning when
compiling with glibc 2.x. Glibc's header files define things like
FD_SET, etc., and the duplicate definitions in the system header files
cause unnecessary warnings for system programs which need to #include
kernel header files such as <linux/ext2_fs.h>.

The patch is safe on both libc5 and glibc 6 systems; it merely surrounds
parts of the header files which are now kernel-specific with:

#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
#endif

Linus, could you apply this to the 2.1 sources, please? Thanks!!

- Ted

Patch generated: on Thu Apr 16 10:38:45 EDT 1998 by tytso@rsts-11.mit.edu
against Linux version 2.1.96

===================================================================
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/04/15 19:53:18 1.1
+++ include/asm-i386/posix_types.h 1998/04/15 19:53:23
@@ -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/04/15 19:53:18 1.1
+++ include/linux/stat.h 1998/04/15 19:53:23
@@ -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/04/15 19:53:18 1.1
+++ include/linux/socket.h 1998/04/15 19:56:12
@@ -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 */
@@ -246,4 +248,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