getifaddrs support for rtems?
kjrobert at alumni.uwaterloo.ca
Wed Sep 19 12:21:36 UTC 2007
Ralf Corsepius wrote:
> On Fri, 2007-09-14 at 17:18 +0100, Keith Robertson wrote:
>> Joel Sherrill wrote:
>>> Keith Robertson wrote:
>>>> indicates this has been asked before, and there appears to be some
>>>> sort of a (AFAIK somewhat involved) work around using the SIOCGIFADDR
>>>> However, most unixes these days seem to have this function and a few
>>>> related ones (getifaddrs freeifaddrs if_nametoindex if_indextoname
>>>> if_nameindex if_freenameindex).
>>>> On linux, these appear to be provided by glibc. As newlib only
>>>> provides the core libc routines, it understandably doesn't appear to
>>>> provide these. To improve the clean portability of other applications
>>>> to rtems, I'd like to find a way to implement these. Where would
>>>> rtems typically obtain such helper routines? Write them ourselves?
>>>> From somewhere in the *Bsd sources? Elsewhere?
>>> The BSD sources are always the best starting point. From there,
>>> all I can say is use the opengroup description and write it yourself.
>> Stupid question: the freebsd man pages have entries for getifaddrs and
>> similar, however, I can't find it mentioned anywhere on lxr for freebsd
>> at: http://fxr.watson.org For linux, this makes sense, as it's provided
>> by glibc, however, who would provide this for freebsd?
> Their libc - They all are there.
> Check out the freebsd source tree from their CVS and you'll find them.
Good news. I've been able to add getifaddrs, if_nameindex, if_indextoname.
The original sources were taken from the freebsd tree and I only needed
to make very minor modifications (commented out a few freebsd related
Diff is attached that includes build support, ifaddrs.h and a minor diff
to net/if.h to add declarations for a few of the functions.
I've not added if_nametoindex as it depends on other functions that
rtems didn't (appear) to have. Specifically, _socket, _close, and
_ioctl. I've not had the time yet to investigate the relationship
between the underscore variants and the normal ones.
I'll send a patch to network demos later today.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the users