[PATCH] SOCK_CLOEXEC for opening sockets

Alan Bateman Alan.Bateman at oracle.com
Wed Jul 25 07:24:35 UTC 2018



On 24/07/2018 21:34, Chris Hegarty wrote:
>> On 19 Jul 2018, at 18:41, Andrew Luo <andrewluotechnologies at outlook.com> wrote:
>>
>> Just checking - is there any other changes that I should make to the patch, or anything else you guys need me to do?
> A webrev genderated from Andrew’s patch along with:
>
> 1) some additional includes of “net_util_md.h” in several missing places
>      in the jdk.net module’s source, as well as the appropriate make change:
>         EXTRA_HEADER_DIRS := \
>            java.base:libnet,
>
> 2) simplified the ifdef structure for NET_Socket and NET_SocketPair
>      in net_util_md.c, and some comment updates, to make it more
>      readable.
>
> http://cr.openjdk.java.net/~chegar/8207335/webrev.00/
>
Thanks for generating a webrev.

As I said previously, the patch isn't complete so native code calling 
fork/exec may still have to deal with other file descriptors that are 
inherited into the child. I don't object to doing this in phases of 
course but somehow we have managed to get by for 20 years without this 
being an issue.

The updates to the various site to use the NET_* functions are fine. 
However, I think the new functions in net_util_md.c could be cleaner. I 
think it would be better to fallback to socket/socketpair + fcntl when 
the initial call fails with EINVAL.

-Alan



More information about the net-dev mailing list