Discussion:
Patch to implement SIOCGIFINDEX
(too old to reply)
matthew sporleder
2013-10-05 22:33:54 UTC
Permalink
I made a new patch for this, including some additional updates to the
netintro man page.

This is based on FreeBSD (ifr_index vs ifr_ifindex on linux)

I'm not sure which one is better and this is just a mechanical patch
as I haven't done any real testing.

Let me know,
Matt
Ted Lemon
2013-10-06 00:00:59 UTC
Permalink
Post by matthew sporleder
I'm not sure which one is better and this is just a mechanical patch
as I haven't done any real testing.
It would be better to use the same API as linux unless there is some reason to use a different API. It is worth noting that programs that depend on the Advanced Sockets API in Linux currently require _GNU_SOURCE to be defined, though, so if you really want to use the FreeBSD name, you could get away with it if you do a #define to make the linux name work as well, and conditionalize it based on the _GNU_SOURCE manifest constant.

Of course, I think the idea of requiring _GNU_SOURCE to be defined to get the Advanced Sockets API is absolute bollocks, but nobody asked me, and the Linux guys seem set on it, so there's no harm in taking advantage of their mishigas.

Ideally POSIX would fix this, but they also seem set on not adopting the Advanced Sockets API for reasons unknown.


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
matthew sporleder
2013-10-06 02:39:06 UTC
Permalink
Post by Ted Lemon
Post by matthew sporleder
I'm not sure which one is better and this is just a mechanical patch
as I haven't done any real testing.
It would be better to use the same API as linux unless there is some reason to use a different API. It is worth noting that programs that depend on the Advanced Sockets API in Linux currently require _GNU_SOURCE to be defined, though, so if you really want to use the FreeBSD name, you could get away with it if you do a #define to make the linux name work as well, and conditionalize it based on the _GNU_SOURCE manifest constant.
Of course, I think the idea of requiring _GNU_SOURCE to be defined to get the Advanced Sockets API is absolute bollocks, but nobody asked me, and the Linux guys seem set on it, so there's no harm in taking advantage of their mishigas.
Ideally POSIX would fix this, but they also seem set on not adopting the Advanced Sockets API for reasons unknown.
In the case of linux names, the patches to use are in this thread:
http://mail-index.netbsd.org/tech-net/2013/04/01/msg003976.html

But I think my man page update is still useful.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...