Problem__kernel_fd_set with glibc-2.0.95

H.J. Lu hjl@lucon.org
Sun Aug 2 09:23:00 GMT 1998


> 
> Hi!
> I tried compile glibc-2.0.95,
> I had error stop under that.
> Plerase give me any suggestion.
> 
> kernel-headers-2.1.103
> egcs-19980727
> Mklinux-DR3
> 
> make  -C socket subdir_lib
> make[2]: Entering directory `/wk-glibc-2.1/glibc-2.0.95/socket'
> gcc ../sysdeps/unix/sysv/linux/recvmsg.c -c -O2 -Wall -Winline -Wno-parentheses 
> -Wstrict-prototypes -Wwrite-strings      -I. -I/wk-glibc-2.1/glibc-build/socket 
> -I.. -I../include -I../libio  -I/wk-glibc-2.1/glibc-build -I../sysdeps/powerpc
> /elf -I../crypt/sysdeps/unix -I../linuxthreads/sysdeps/unix/sysv/linux -I../
> linuxthreads/sysdeps/pthread -I../linuxthreads/sysdeps/unix/sysv -I../linuxthreads
> /sysdeps/unix -I../linuxthreads/sysdeps/powerpc -I../linuxthreads/sysdeps/pthread
> /cmpxchg -I../sysdeps/unix/sysv/linux/powerpc -I../sysdeps/unix/sysv/linux -
> I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps
> /unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix -I../sysdeps/posix -I../
> sysdeps/powerpc -I../sysdeps/wordsize-32 -I../sysdeps/ieee754 -I../sysdeps/libm-ieee754 
> -I../sysdeps/generic/elf -I../sysdeps/generic   -D_LIBC_REENTRANT -include .
> ./include/libc-symbols.h     -o /wk-glibc-2.1/glibc-build/socket/recvmsg.o
> In file included from ../sysdeps/unix/sysv/linux/recvmsg.c:23:
> /usr/include/asm/posix_types.h:49: parse error before `__kernel_fd_set'
> /usr/include/asm/posix_types.h:50: warning: function declaration isn't a prototype
> 
> /usr/include/asm/posix_types.h: In function `__FD_SET':
> /usr/include/asm/posix_types.h:51: `fd' undeclared (first use in this function
> )
> /usr/include/asm/posix_types.h:51: (Each undeclared identifier is reported only 
> once
> /usr/include/asm/posix_types.h:51: for each function it appears in.)
> /usr/include/asm/posix_types.h:53: `fdsetp' undeclared (first use in this function
> )
> /usr/include/asm/posix_types.h: At top level:
> /usr/include/asm/posix_types.h:57: parse error before `__kernel_fd_set'
> /usr/include/asm/posix_types.h:58: warning: function declaration isn't a prototype
> 
> /usr/include/asm/posix_types.h: In function `__FD_CLR':
> /usr/include/asm/posix_types.h:59: `fd' undeclared (first use in this function
> )
> /usr/include/asm/posix_types.h:61: `fdsetp' undeclared (first use in this function
> )
> /usr/include/asm/posix_types.h: At top level:
> /usr/include/asm/posix_types.h:65: parse error before `__kernel_fd_set'
> /usr/include/asm/posix_types.h:66: warning: function declaration isn't a prototype
> 
> /usr/include/asm/posix_types.h: In function `__FD_ISSET':
> /usr/include/asm/posix_types.h:67: `fd' undeclared (first use in this function
> )
> /usr/include/asm/posix_types.h:69: `p' undeclared (first use in this function
> )
> /usr/include/asm/posix_types.h:70: warning: control reaches end of non-void 
> function
> /usr/include/asm/posix_types.h: At top level:
> /usr/include/asm/posix_types.h:77: parse error before `*'
> /usr/include/asm/posix_types.h:78: warning: function declaration isn't a prototype
> 
> /usr/include/asm/posix_types.h: In function `__FD_ZERO':
> /usr/include/asm/posix_types.h:79: `p' undeclared (first use in this function
> )
> /usr/include/asm/posix_types.h:82: `__FDSET_LONGS' undeclared (first use in 
> this function)
> /usr/include/asm/posix_types.h:85: warning: unreachable code at beginning of
>  switch statement
> make[2]: *** [/wk-glibc-2.1/glibc-build/socket/recvmsg.o] Error 1
> make[2]: Leaving directory `/wk-glibc-2.1/glibc-2.0.95/socket'
> make[1]: *** [socket/subdir_lib] Error 2
> make[1]: Leaving directory `/wk-glibc-2.1/glibc-2.0.95'
> make: *** [all] Error 2
> 
> Kaoru Fukui
> k_fukui@highway.ne.jp
> 

Here is a patch for Linux 2.1.113. The problem is glibc has its own
FD_XXXX/__FD_XXXX. Kernel should not expose its version unconditionally.
Only include/asm-i386/posix_types.h does it right.

-- 
H.J. Lu (hjl@gnu.org)
----
Index: include/asm-alpha/posix_types.h
===================================================================
RCS file: /home/work/cvs/linux/linux/include/asm-alpha/posix_types.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 posix_types.h
--- include/asm-alpha/posix_types.h	1997/12/10 19:20:25	1.1.1.2
+++ include/asm-alpha/posix_types.h	1998/08/02 16:20:42
@@ -34,6 +34,8 @@
 	int	val[2];
 } __kernel_fsid_t;
 
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
 #ifndef __GNUC__
 
 #define	__FD_SET(d, set)	((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
@@ -108,5 +110,7 @@
 }
 
 #endif /* __GNUC__ */
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
 
 #endif /* _ALPHA_POSIX_TYPES_H */
Index: include/asm-arm/posix_types.h
===================================================================
RCS file: /home/work/cvs/linux/linux/include/asm-arm/posix_types.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 posix_types.h
--- include/asm-arm/posix_types.h	1998/05/21 15:02:56	1.1.1.2
+++ include/asm-arm/posix_types.h	1998/08/02 16:21:04
@@ -51,6 +51,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) \
 		(((fd_set *)fdsetp)->fds_bits[fd >> 5] |= (1<<(fd & 31)))
@@ -66,5 +68,7 @@
 #undef	__FD_ZERO
 #define __FD_ZERO(fdsetp) \
 		(memset (fdsetp, 0, sizeof (*(fd_set *)fdsetp)))
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
 
 #endif
Index: include/asm-i386/posix_types.h
===================================================================
RCS file: /home/work/cvs/linux/linux/include/asm-i386/posix_types.h,v
retrieving revision 1.1.1.3
retrieving revision 1.5
diff -u -r1.1.1.3 -r1.5
Index: include/asm-m68k/include/asm-i386/posix_types.h
===================================================================
RCS file: /home/work/cvs/linux/linux/include/asm-m68k/posix_types.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 posix_types.h
--- posix_types.h	1997/12/10 19:20:28	1.1.1.2
+++ posix_types.h	1998/08/02 16:19:11
@@ -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(d, set)	((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
 
@@ -48,5 +50,7 @@
 
 #undef	__FD_ZERO
 #define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
 
 #endif
Index: include/asm-mips/posix_types.h
===================================================================
RCS file: /home/work/cvs/linux/linux/include/asm-mips/posix_types.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 posix_types.h
--- include/asm-mips/posix_types.h	1998/01/09 17:57:40	1.1.1.3
+++ include/asm-mips/posix_types.h	1998/08/02 16:21:32
@@ -46,6 +46,8 @@
         long    val[2];
 } __kernel_fsid_t;
 
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
 #undef __FD_SET
 static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
 {
@@ -113,5 +115,7 @@
 		__tmp++;
 	}
 }
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
 
 #endif /* __ARCH_MIPS_POSIX_TYPES_H */
Index: include/asm-ppc/posix_types.h
===================================================================
RCS file: /home/work/cvs/linux/linux/include/asm-ppc/posix_types.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 posix_types.h
--- include/asm-ppc/posix_types.h	1997/12/10 19:20:37	1.1.1.3
+++ include/asm-ppc/posix_types.h	1998/08/02 16:21:58
@@ -33,6 +33,8 @@
 	int	val[2];
 } __kernel_fsid_t;
 
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
 #ifndef __GNUC__
 
 #define	__FD_SET(d, set)	((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
@@ -96,5 +98,7 @@
 }
 
 #endif /* __GNUC__ */
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
 
 #endif /* _PPC_POSIX_TYPES_H */
Index: include/asm-sparc/posix_types.h
===================================================================
RCS file: /home/work/cvs/linux/linux/include/asm-sparc/posix_types.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 posix_types.h
--- include/asm-sparc/posix_types.h	1997/12/10 19:20:32	1.1.1.2
+++ include/asm-sparc/posix_types.h	1998/08/02 16:19:41
@@ -40,6 +40,8 @@
 	int	val[2];
 } __kernel_fsid_t;
 
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
 #undef __FD_SET
 static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
 {
@@ -108,5 +110,7 @@
 		tmp++;
 	}
 }
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
 
 #endif /* !(__ARCH_SPARC_POSIX_TYPES_H) */
Index: include/asm-sparc64/posix_types.h
===================================================================
RCS file: /home/work/cvs/linux/linux/include/asm-sparc64/posix_types.h,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 posix_types.h
--- include/asm-sparc64/posix_types.h	1998/02/02 00:47:37	1.1.1.5
+++ include/asm-sparc64/posix_types.h	1998/08/02 16:20:16
@@ -58,6 +58,8 @@
 typedef long		       __kernel_loff_t32;
 typedef __kernel_fsid_t        __kernel_fsid_t32;
 
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
 #undef __FD_SET
 static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
 {
@@ -126,5 +128,7 @@
 		tmp++;
 	}
 }
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
 
 #endif /* !(__ARCH_SPARC64_POSIX_TYPES_H) */



More information about the Libc-hacker mailing list