JDK-8080990: libdt_socket/socket_md.c(202) : warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW()

gary.adams at oracle.com gary.adams at oracle.com
Wed Feb 7 22:24:49 UTC 2018


On 2/7/18 12:55 PM, gary.adams at oracle.com wrote:
> On 2/7/18 12:31 PM, Chris Hegarty wrote:
>> Gary,
>>
>>> http://cr.openjdk.java.net/%7Egadams/8080990/webrev.02/
>> I think the replacement of WSASendDisconnect with
>> shutdown(SD_SEND) should be fine. I do note that there
>> is another usage of WSASendDisconnect in
>> java.base/windows/native/libnet/net_util_md.c.
> Thanks for the reference.
> I'm not sure how that one slipped by unnoticed.
I found in make/lib/NetworkingLibraries.gmk the BUILD_LIBNET
target includes a number of specific disabled warnings. In particular,
4996 which suppresses all deprecated function warnings.

I think I'd like to get the current changes pushed to remove the specific
WINSOCK_DEPRECATED_NO_WARNINGS and then file another bug to
come back and look at selective makefiles that use a blanket 4996
suppression of deprecated warnings.

>>
>> [ Maybe you want to separate out the changes in java.base
>> ( NIO and NET ) from the serviceability changes? Up to
>> you. ]
> Actually, this change  is about removing the compilation flag globally
> in flags.m4 and any sources that need to be updated
> to replace the deprecated functions.
>>
>> Curious about the specific hints you have chosen to use.
>> In other areas we have the following:
>>    hints.ai_flags = AI_CANONNAME;
>>    hints.ai_family = AF_INET;
>>
>> [ Not saying that what you have is incorrect, just questioning
>>   if you need to specify the socket type and protocol ]
> One of the benefits of getaddrinfo is that it can return a list of
> addresses from the name service. In the places we were using
> gethostbyname we were looking for just one ipv4 address.
> By adding additional constraints on the supplied hints, it can help
> reduce the list of returned addresses.
>
>>
>> -Chris.
>
>



More information about the serviceability-dev mailing list