[klibc] [socket.h] add (more) missing definitions

KUMAAN 9maaan at gmail.com
Mon Aug 8 10:49:21 PDT 2011


Hello

(2011/08/08 21:22), Andrea Adami wrote:
> Hello,
>
> to compile kexec-tools statically against klibc we still need a patch
> for socket.h, otherwise:
>
> | kexec/ifdown.c:46:16: error: 'SIOCGIFCONF' undeclared (first use in
> this function)
> | kexec/ifdown.c:46:16: note: each undeclared identifier is reported
> only once for each function it appears in
> | kexec/ifdown.c:65:18: error: 'SIOCSIFFLAGS' undeclared (first use in
> this function)

SIOCGIFCONF and SIOCSIFFLAGS are arguments for ioctl().
Including 'sys/ioctl.h' of Embedded GNU C Library define them,
but including 'sys/socket.h' of it do not define them.
Of course, 'kexec-tools/kexec/ifdown.c' includes <sys/ioctl.h> also.

This is why 'sys/ioctl.h' of klibc may have to be changed
if klibc wants more compatibility with (Embedded) GNU C Library.
For example, as you wrote, it may have to include 'linux/sockios.h'.


Test:

$ cat foo.c
#include <sys/socket.h>
#ifdef SIOCGIFCONF
# error "SIOCGIFCONF is defined."
#else
# error "SIOCGIFCONF is NOT defined."
#endif

#include <sys/ioctl.h>
#ifdef SIOCGIFCONF
# error "SIOCGIFCONF is defined."
#else
# error "SIOCGIFCONF is NOT defined."
#endif

$ gcc foo.c
foo.c:5:3: error: #error "SIOCGIFCONF is NOT defined."
foo.c:10:3: error: #error "SIOCGIFCONF is defined."


thank you.
--
KUMAAN
9maaan at gmail.com



More information about the klibc mailing list