JDK-8247942 : Unix domain socket channel implementation
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.nio
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 16
  • Submitted: 2020-06-19
  • Updated: 2020-10-08
  • Resolved: 2020-10-08
Related Reports
CSR :  
Description
Summary
-------

Add support for Unix domain sockets in java.nio.channels.SocketChannel and ServerSocketChannel as part of JEP 380.

**NOTE** This CSR was previously approved, but not integrated. It is being resubmitted to:

1) make some very small api changes (diffs from approved version are in attached api_v2.diffs)

2) define a new system/networking property, (described below in specification).

The original api webrev and specdiff are still attached. 

The NEW api webrev and specdiff are attached in webrev.csr.final.v2.zip and specdiff.csr.final.v2.zip respectively and links to online versions of the same are provided below.

Problem
-------

A small API change is required to support Unix domain sockets in NIO. 

Solution
--------

The spec change comprises:

 - an additional enum value (UNIX) to java.net.StandardProtocolFamily 
 - a new sub-class of java.net.SocketAddress to represent Unix domain
   addresses 
 - additional normative text in SocketChannel and
   ServerSocketChannel describing the new behavior
 - normative text in java.nio.channels package description
 - additional target added to java.net.NetPermission
 - additional supporting methods in the SPI
 - a related extended socket option in jdk.net.ExtendedSocketOptions (being put here because not all platforms can support the option)
 - new class jdk.net.UnixDomainPrincipal to support socket option above

Specification
-------------

Specdiff and webrev are attached. Links to external webrev and specdiff below.

OLD WEBREV and SPECDIFF (for reference only)

API WEBREV: http://cr.openjdk.java.net/~michaelm/8245194/api.webrev/webrev.csr.final/

SPECDIFF: http://cr.openjdk.java.net/~michaelm/8245194/specdiff/specdiff.csr.final/overview-summary.html

NEW WEBREV and SPECDIFF (the spec)

API WEBREV: http://cr.openjdk.java.net/~michaelm/8245194/api.webrev/webrev.csr.final.v2/

SPECDIFF: http://cr.openjdk.java.net/~michaelm/8245194/specdiff/specdiff.csr.final.v2/overview-summary.html

See attached api_v2.diffs for API differences from approved version

New system/networking property as described in following text added to `conf/net.properties`

Unix version
```   
     #
     # Default directory where automatically bound Unix domain server
     # sockets are stored. Sockets are automatically bound when bound
     # with a null address.
     #
     # On Unix the search order to determine this directory is:
     #
     # 1. System property jdk.net.unixdomain.tmpdir
     #
     # 2. Networking property jdk.net.unixdomain.tmpdir specified
     #    in this file (effective default)
     #
     # 3. System property java.io.tmpdir
     #
     jdk.net.unixdomain.tmpdir=/tmp
```
Windows version
```
    #
    # Default directory where automatically bound Unix domain server
    # sockets are stored. Sockets are automatically bound when bound
    # with a null address.
    #
    # The search order for the directory on Windows is:
    #
    # 1. System property "jdk.net.unixdomain.tmpdir"
    #
    # 2. Networking property "jdk.net.unixdomain.tmpdir" specified
    #    in this file (not set by default)
    #
    # 3. The TEMP environment variable (the effective default)
    #
    # 4. The java.io.tmpdir system property
    #
    #jdk.net.unixdomain.tmpdir=
    #
```

Comments
[~michaelm], thank you for including the diffs from the previously approved version; moving revised version to Approved.
08-10-2020

The proposed updates look good to me. Consider it re-reviewed.
07-10-2020

Moving to Approved.
05-08-2020

Moving to Provisional.
01-07-2020