Re: [libvirt] Redefinition of struct in6_addr in <netinet/in.h> and <linux/in6.h>

From: Mike Frysinger <vapier@gentoo.org> Date: Wed, 16 Jan 2013 12:28:39 -0500
if you're not calling the kernel directly, why are you including the kernel headers ? what is the problem people are actually trying to address here (and no, "i want to include both headers" is not the answer) ?
When GLIBC doesn't provide it's own definition of some networking macros or interfaces that the kernel provides, people include the kernel header. This has been done for decades, wake up.

On Thu, Jan 17, 2013 at 2:59 AM, David Miller <davem@davemloft.net> wrote:
When GLIBC doesn't provide it's own definition of some networking macros or interfaces that the kernel provides, people include the kernel header.
Recently I got a problem when copying a structure from kernel to userspace, after debugging I found: kernel: include/linux/inet.h #define INET6_ADDRSTRLEN (48) glibc: /usr/include/netinet/in.h #define INET6_ADDRSTRLEN 46 Any reason to differentiate them from each other? -- Thanks, Jike

On Thu, 2013-01-17 at 11:55 +0800, Jike Song wrote:
On Thu, Jan 17, 2013 at 2:59 AM, David Miller <davem@davemloft.net> wrote:
When GLIBC doesn't provide it's own definition of some networking macros or interfaces that the kernel provides, people include the kernel header.
Recently I got a problem when copying a structure from kernel to userspace, after debugging I found:
kernel: include/linux/inet.h
#define INET6_ADDRSTRLEN (48)
glibc: /usr/include/netinet/in.h
#define INET6_ADDRSTRLEN 46
Any reason to differentiate them from each other?
I see no reason, even although I don't know why it is 46 instead of 40. But include/linux/inet.h is not exported to user-space, AFAIK.
participants (3)
-
Cong Wang
-
David Miller
-
Jike Song