On 10/26/2011 04:30 PM, Alan Bateman wrote:
On 26/10/2011 08:47, Charles Lee wrote:
But I do not get getaddrinfo is ipv6 specified. Do I miss sth?
If I recall correctly, when the support for IPv6 was added (predates
OpenJDK as it was jdk1.4, as in 10 years ago) then
getaddrinfo/getnameinfo/etc. wasn't not widely supported and if I
think was part of the RFC that defined the socket extensions for IPv6.
I don't think this code has changed too much since then and probably
could do with a clean-up. That said, I would be surprised if there are
platforms that don't have gethostbyname/gethostbyaddr and their
reentrant forms. I'm curious as to the background to this thread, are
you porting to some platform that doesn't have the legacy
gethostbyname/gethostbyaddr or just auditing the use of the system and
library calls?
-Alan
/>>> I don't think this code has changed too much since then and
probably could do with a clean-up./
Not true. Below are some snippet I get from my ubuntu and openSolaris
man page:
Ubuntu:
The gethostbyname*() and gethostbyaddr*() functions are obsolete.
Applications should use getaddrinfo(3) and getnameinfo(3) instead.
openSolaris:
These functions have been superseded by getipnodebyname(3SOCKET),
getipnodebyaddr(3SOCKET), and getaddrinfo(3SOCKET), which provide
greater portability to
applications when multithreading is performed or technolo-
gies such as IPv6 are used.
It shows that getaddrinfo now is the suggested native api. And from
http://pubs.opengroup.org/onlinepubs/9699919799/ , you will get:
The obsolescent/h_errno/external integer, and the
obsolescent/gethostbyaddr/()
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostbyaddr.html>,
and/gethostbyname/()
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostbyname.html>functions
are removed, along with the HOST_NOT_FOUND, NO_DATA, NO_RECOVERY,
and TRY_AGAIN macros.
Since openjdk may have its minium support platform, I believe it is
always welcome to the new things.
/>>> are you porting to some platform
/Yes. We are trying our best to make our patches easy to be accepted by
the community. gethostbyaddr and gethostbyname do support on our
platform but with very different parameters. It is so lucky that
getaddrinfo are the suggested method and common in at least three
platforms: linux, openSolaris and our platform :-)
/
/
--
Yours Charles