----- Original Message ----- > Hi all, > In an effort to get ATS to build on OpenBSD, I noticed that we're > using > gethostbyname_r and gethostbyaddr_r (see ink_inet.cc), according to > the > manpage both of these APIs are obsolete and getaddrinfo should be > used > (which is reentrant by default), I only noticed this because OpenBSD > 5.0 > doesn't support them. What does everyone think about doing the > following: > > As a first step I will create a new function called > ink_getaddrinfo(). > Next, I will rewrite ink_gethostbyname_r() and ink_gethostbyaddr_r() > to > wrap ink_getaddrinfo(), this will be tricky because I will need to > manually > create the hostent structs to not break existing code that uses > ink_gethostbyname_r and inkgethostbyaddr_r, does that seem hacky? The > nice > thing about getaddrinfo is that it appears we will be able to get rid > of > several defines such as RENTRENT_GETHOSTBYNAME and > GETHOSTBYNAME_R_GLIBC2 > since the API seems to be consistant across BSD, Linux, and Darwin, > unless > there is something i'm missing? Lastly, I will try to switch all > usages of > ink_gethostbyname/addr_r over to the new ink_getaddrinfo(), at which > point > I will remove them entirely. > > Thoughts?
The pattern is the same as for strlcpy() and other functions that wrap because they don't exist on all platforms. Geoff Greer's silver searcher uses some automagick to help this case maybe we could adapt that too? (if we don't already do) https://github.com/ggreer/the_silver_searcher/blob/master/src/util.h https://github.com/ggreer/the_silver_searcher/blob/master/src/util.c https://github.com/ggreer/the_silver_searcher/blob/master/configure.ac That would skip at least one step in the process. > Brian So long, i -- Igor Galić Tel: +43 (0) 664 886 22 883 Mail: i.ga...@brainsware.org URL: http://brainsware.org/ GPG: 6880 4155 74BD FD7C B515 2EA5 4B1D 9E08 A097 C9AE