This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linux issues with <net/if.h> and <linux/if.h>


On Friday 10 August 2012 16:40:43 Philip Prindeville wrote:
> I'm working on the networking code for Poco on Centos 6.2, and am in a
> situation where I need to use both <net/if.h> and <linux/if.h> in the same
> source file.

generally speaking, if you're using the C library API, then stick to net/*.  
if you're talking directly to the kernel, then stick to linux/*.  do not mix 
the two.

> Unfortunately, doing so gets me:
> 
> In file included from src/NetworkInterface.cpp:1032:
> /usr/include/linux/if.h:139: error: redefinition of ‘struct ifmap’
> /usr/include/net/if.h:113: error: previous definition of ‘struct ifmap’
> /usr/include/linux/if.h:175: error: redefinition of ‘struct ifreq’
> /usr/include/net/if.h:128: error: previous definition of ‘struct ifreq’
> /usr/include/linux/if.h:225: error: redefinition of ‘struct ifconf’
> /usr/include/net/if.h:178: error: previous definition of ‘struct ifconf’
> 
> 
> I need <net/if.h> for the if_indextoname() stuff, but I need <linux/if.h>
> for the correct IFF_* flags (some of which are also defined in
> <net/if.h>).

please post a patch to add any new/missing flags to net/if.h that are not yet 
there.

> Better yet, is there a simpler solution to this issue?

convince the kernel people to not export the same struct names as the C 
library.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]