Skip to contentSkip to conversation

linux/{socket,stat}.h: change __GLIBC__ cruft to __KLIBC__

PATCH In review Mike Frysinger 3 participants 4 messages Jan 2, 2008 Sockets

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux/{socket,stat}.h: change __GLIBC__ cruft to __KLIBC__

The __GLIBC__ hacks were re-added to the headers because the klibc peeps want to be lazy. But rather than properly address things, they just wrongly left it as __GLIBC__. This patch changes the __GLIBC__ cruft to __KLIBC__ so real libcs don't get screwed due to kilbc's laziness.

---

include/linux/socket.h +1 -1
index c22ef1c..90af15b 100644
@@ -16,7 +16,7 @@ struct __kernel_sockaddr_storage {
 				/* _SS_MAXSIZE value minus size of ss_family */
 } __attribute__ ((aligned(_K_SS_ALIGNSIZE)));	/* force desired alignment */
 
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+#if defined(__KERNEL__) || defined(__KLIBC__)
 
 #include <asm/socket.h>			/* arch-dependent defines	*/
 #include <linux/sockios.h>		/* the SIOCxxx I/O controls	*/
include/linux/stat.h +1 -1
index 611c398..e8c1943 100644
@@ -7,7 +7,7 @@
 
 #endif
 
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+#if defined(__KERNEL__) || defined(__KLIBC__)
 
 #define S_IFMT  00170000
 #define S_IFSOCK 0140000
#1 lore raw
Quoted 12 lines · Mike Frysinger

The __GLIBC__ hacks were re-added to the headers because the klibc peeps want to be lazy. But rather than properly address things, they just wrongly left it as __GLIBC__. This patch changes the __GLIBC__ cruft to __KLIBC__ so real libcs don't get screwed due to kilbc's laziness.

---

include/linux/socket.h +0 -0
index c22ef1c..90af15b 100644

include/linux/socket.h struct __kernel_sockaddr_storage { · line 19

Quoted 6 lines
include/linux/socket.h +1 -1
@@ -16,7 +16,7 @@ struct __kernel_sockaddr_storage {
 				/* _SS_MAXSIZE value minus size of ss_family */
 } __attribute__ ((aligned(_K_SS_ALIGNSIZE)));	/* force desired alignment */
 
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+#if defined(__KERNEL__) || defined(__KLIBC__)
...

This changes the semantics from "!glibc" to "klibc".

I'm a bit worried that such changes might break some of the other libc's people use on Linux.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#2 lore raw
Quoted 17 lines · Adrian Bunk
Quoted 16 lines · Mike Frysinger

The __GLIBC__ hacks were re-added to the headers because the klibc peeps want to be lazy. But rather than properly address things, they just wrongly left it as __GLIBC__. This patch changes the __GLIBC__ cruft to __KLIBC__ so real libcs don't get screwed due to kilbc's laziness.

---

include/linux/socket.h +0 -0
index c22ef1c..90af15b 100644
@@ -16,7 +16,7 @@ struct __kernel_sockaddr_storage {
 				/* _SS_MAXSIZE value minus size of ss_family */
 } __attribute__ ((aligned(_K_SS_ALIGNSIZE)));	/* force desired alignment
 */
 
Quoted 5 lines

include/linux/socket.h struct __kernel_sockaddr_storage { · line 20

Quoted 3 lines
include/linux/socket.h +1 -1
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+#if defined(__KERNEL__) || defined(__KLIBC__)
...

This changes the semantics from "!glibc" to "klibc".

that's the point

Quoted 2 lines

I'm a bit worried that such changes might break some of the other libc's people use on Linux.

such libc's are broken and it isnt the kernel's problem to cater to broken libc's. the problem is that these headers are breaking things *now* for valid libc's that are not glibc. removal of __GBLIC__ was already accepted once but reverted for klibc.
-mike

#3 lore raw
Quoted 6 lines · Mike Frysinger
Quoted 5 lines

Review

Quoted 4 lines
(quoted diff) +1 -1
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+#if defined(__KERNEL__) || defined(__KLIBC__)
...

This changes the semantics from "!glibc" to "klibc".

Quoted 7 lines

that's the point

Quoted 2 lines

I'm a bit worried that such changes might break some of the other libc's people use on Linux.

such libc's are broken and it isnt the kernel's problem to cater to broken libc's. the problem is that these headers are breaking things *now* for valid libc's that are not glibc. removal of __GBLIC__ was already accepted once but reverted for klibc. -mike

Either of these really is wrong... it's the userspace which should ask for what should be imported; the kernel shouldn't hard-code which libcs want what.

I just posted a patch to the netdev list which splits the top of <linux/socket.h> out into <linux/sockaddr.h>, userspace can choose to include one or the other.

-hpa