LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch] scrub non-__GLIBC__ checks in linux/socket.h and linux/stat.h
@ 2006-12-16 18:42 Mike Frysinger
  2006-12-16 18:57 ` Erik Andersen
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2006-12-16 18:42 UTC (permalink / raw)
  To: linux-kernel, netdev, viro; +Cc: Alexey Dobriyan, Robert P. J. Day

[-- Attachment #1: Type: text/plain, Size: 722 bytes --]

On 11/30/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
> but there are a few other
> cases which still contain compound preprocessor directives such as:
>
>   #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
>
> having never worked with unifdef before, i guess i was being overly
> optimistic in thinking that it, if i "unifdef"ed __KERNEL__, it might
> at least simplify the expression.  oh, well ... live and learn.

userspace should be worrying about userspace, so having the socket.h
and stat.h pollute the namespace in the non-glibc case is wrong and
pretty much prevents any other libc from utilizing these headers
sanely unless they set up the __GLIBC__ define themselves (which
sucks)
-mike

[-- Attachment #2: linux-scrub-GLIBC-ifdefs.patch --]
[-- Type: application/octet-stream, Size: 729 bytes --]

index 92cd38e..545c041 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -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)
+#ifdef __KERNEL__
 
 #include <asm/socket.h>			/* arch-dependent defines	*/
 #include <linux/sockios.h>		/* the SIOCxxx I/O controls	*/
index 679ef0d..59e6ba3 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -7,7 +7,7 @@
 
 #endif
 
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+#ifdef __KERNEL__
 
 #define S_IFMT  00170000
 #define S_IFSOCK 0140000

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] scrub non-__GLIBC__ checks in linux/socket.h and linux/stat.h
  2006-12-16 18:42 [patch] scrub non-__GLIBC__ checks in linux/socket.h and linux/stat.h Mike Frysinger
@ 2006-12-16 18:57 ` Erik Andersen
  2007-01-25  6:30   ` H. Peter Anvin
  0 siblings, 1 reply; 3+ messages in thread
From: Erik Andersen @ 2006-12-16 18:57 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: linux-kernel, netdev, viro, Alexey Dobriyan, Robert P. J. Day

On Sat Dec 16, 2006 at 01:42:11PM -0500, Mike Frysinger wrote:
> On 11/30/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
> >but there are a few other
> >cases which still contain compound preprocessor directives such as:
> >
> >  #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
> >
> >having never worked with unifdef before, i guess i was being overly
> >optimistic in thinking that it, if i "unifdef"ed __KERNEL__, it might
> >at least simplify the expression.  oh, well ... live and learn.
> 
> userspace should be worrying about userspace, so having the socket.h
> and stat.h pollute the namespace in the non-glibc case is wrong and
> pretty much prevents any other libc from utilizing these headers
> sanely unless they set up the __GLIBC__ define themselves (which
> sucks)
> -mike

Ack from me.  I'd love to see this applied so uClibc could
stop have to define __GLIBC__

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] scrub non-__GLIBC__ checks in linux/socket.h and linux/stat.h
  2006-12-16 18:57 ` Erik Andersen
@ 2007-01-25  6:30   ` H. Peter Anvin
  0 siblings, 0 replies; 3+ messages in thread
From: H. Peter Anvin @ 2007-01-25  6:30 UTC (permalink / raw)
  To: andersen, Mike Frysinger, linux-kernel, netdev, viro,
	Alexey Dobriyan, Robert P. J. Day

Erik Andersen wrote:
> On Sat Dec 16, 2006 at 01:42:11PM -0500, Mike Frysinger wrote:
>> On 11/30/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
>>> but there are a few other
>>> cases which still contain compound preprocessor directives such as:
>>>
>>>  #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
>>>
>>> having never worked with unifdef before, i guess i was being overly
>>> optimistic in thinking that it, if i "unifdef"ed __KERNEL__, it might
>>> at least simplify the expression.  oh, well ... live and learn.
>> userspace should be worrying about userspace, so having the socket.h
>> and stat.h pollute the namespace in the non-glibc case is wrong and
>> pretty much prevents any other libc from utilizing these headers
>> sanely unless they set up the __GLIBC__ define themselves (which
>> sucks)
>> -mike
> 
> Ack from me.  I'd love to see this applied so uClibc could
> stop have to define __GLIBC__
> 

klibc uses these definitions, but the right thing to do is to have libc 
ask for it:

#if defined(__KERNEL__) || defined(__EXPORT_LINUX_SOCKET_H)

/* ... */

#endif

That way, klibc can just

#define __EXPORT_LINUX_SOCKET_H
#include <linux/socket.h>

	-hpa

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-25  6:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-16 18:42 [patch] scrub non-__GLIBC__ checks in linux/socket.h and linux/stat.h Mike Frysinger
2006-12-16 18:57 ` Erik Andersen
2007-01-25  6:30   ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).