Headers for network applications : include netinet/* or linux/*

Headers for network applications : include netinet/* or linux/*

Lev Olshvang lolshva at 012.net.il
Mon Feb 6 08:57:03 IST 2012


Morning  Dear Listers,



I am looking for the "right" solution for following problem.


I came recently across some of multicast setsockopt() calls that have their
structures defined in /usr/include/linux/ directory.

But you cannot leave without arpa/net  functions such as htons() and alike.

But  when you try to include these files, the comlpilation fails on
symbol redeclaration between netinet/in.h and linux/netinet.h.

The origin of the problem I understand :
kernel exports its interface to include/linux,
whils include/net , include/netinet are libc productions.

It is really strange for me that major distributions did not fix the 
problem,
theer is a bug opened on this issue in uclibc.

http://lists.uclibc.org/pipermail/uclibc-cvs/2011-July/029794.html

I have solved it in a quick and dirty way ( #define NETINED_IN_H, ..)  
but what is a right thing to do ?

Best Day,
Lev




More information about the Linux-il mailing list