Search Linux Wireless

Re: [PATCH] wireless.h: improve userland include-ability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 04, 2008 at 02:52:09PM +0100, David Woodhouse wrote:
> On Tue, 2008-06-03 at 12:05 -0700, David Miller wrote:
> > Yeah, go check so me magic userspace tool header to see what magic is
> > needed just to include a core networking header file correctly.
> > 
> > No, thanks.
> 
> Just to clarify: this is only a problem for userspace, and you're
> objecting to that? Just including <linux/wireless.h> within the kernel
> will continue to work.
> 
> We've traditionally got away with saying 'caveat emptor' when userspace
> includes kernel headers -- you _have_ to include the right
> prerequisites, because the kernel doesn't do it for you.
> 
> I'm happy enough to change that, but it means seeing stuff like...
> 	#ifndef __KERNEL__
> 	#include <sys/foo.h>
> 	#endif 
> ... in kernel headers. Is that what you're intending, or am I
> misunderstanding your objection?
> 
> I believe that the main reason for this patch was that <linux/socket.h>
> and <linux/if.h> both have problems when you include them in the same C
> file as the 'proper' glibc equivalent? Is that something we can address,
> instead of just dropping those includes?

What do you think about hack linke this:

#include <linux/types.h>                /* for __u* and __s* typedefs */
#if defined(__KERNEL__) || !defined(_SYS_SOCKET_H)
#include <linux/socket.h>               /* for "struct sockaddr" et al  */
#endif
#if defined(__KERNEL__) || !defined(_NET_IF_H)
#include <linux/if.h>                   /* for IFNAMSIZ and co... */
#endif

It avoids conflict between glibc's and kernel's headers if glibc's headers 
include first.

-- 
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.com/

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux