On Thu, 18 Oct 2007, Satish Vellanki wrote:
> The error is generated by the call to _llseek, internal to ioctl call.
> You get ESPIPE when you try to seek a non-seekable source.
> But ioctl itself returns 0(success) and also the interfaces can be enumerated.
> ioctl(3, SIOCGIFCONF, {64, {{"lo", {AF_INET, inet_addr("127.0.0.1")}},
> {"eth0", {AF_INET, inet_addr("129.118.162.51")}}}}) = 0
>
> If you do not wanna see this,
> try the alternative ifaddrs() in ifaddrs.h to list interfaces.
>
> --
> Satish Vellanki
Hi Satish:
/sbin/ifconfig command uses the same approach that I have adopted,
ie. pass SIOCGIFCONF to ioctl()
This is the approach documented in TCP/IP Illustrated Vol 2, stevens.
don't want to use
extern int getifaddrs (struct ifaddrs **__ifap) __THROW;
as that would lead to glibc dependency
for a function that does not really belong in there.
i will try to check ifaddrs() implementation and see what they do.
If nothing works out then I will try the following approach
. work with /proc/net/dev to get the interfaces
. use struct ifreq and SIOCGIFLAGS for ioctl()
thanks
Saifi.