RFR(L): 8167295: Contribute further changes from SAP to native parts of libnet/libnio
Langer, Christoph
christoph.langer at sap.com
Thu Oct 6 15:43:37 UTC 2016
Hi,
I'm looking to contribute a few of our diffs in the network area to OpenJDK.
This is the bug: https://bugs.openjdk.java.net/browse/JDK-8167295
This is the webrev: http://cr.openjdk.java.net/~clanger/webrevs/8167295.0/
Besides minor cleanups, initializations and fixes, the main thing that I'm proposing is the unification of the union datatype SOCKADDR (unix) and SOCKETADDRESS (windows).
I think the definition for all platforms should basically look like the following, of course depending on IPv6 support and the local datatypes:
typedef union {
struct sockaddr him;
struct sockaddr_in him4;
struct sockaddr_in6 him6;
} SOCKETADDRESS;
The type 'SOCKADDR' is already defined on Windows so we should consistently use 'SOCKETADDRESS'. This move would allow for better writing of shared code dealing with sockaddr structures, which we do at SAP especially for some tracing code.
I don't know yet if it's a good idea to get rid of the definitions SOCKADDR_LEN resp. SOCKETADDRESS_LEN(x) and fully rely on sizeof(SOCKETADDRESS). I've done this in my webrev and it builds. But I'm not sure if especially some Windows APIs would behave strangely if passed in a longer length values for an AF_INET socket address. Maybe you have some comments on that point.
Apart from that, I think it is a good idea to get rid of 'NET_AllocSockaddr' as there is no need to malloc SOCKETADDRESS fields at the few places where it was used (libnio unix only). A stack variable would probably be better and less error prone. And the declaration of NET_Wait can move to the common net_util.h header as the function is available everywhere with the same signature.
Right now I'm just at a stage where my change builds on all platforms and I need to do some further testing. But I'm hoping for some early comments :)
Thanks and best regards
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20161006/d83eed53/attachment.html>
More information about the nio-dev
mailing list