JDK-8291067 : macOS should use O_CLOEXEC instead of FD_CLOEXEC
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 20
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2022-07-26
  • Updated: 2022-12-15
  • Resolved: 2022-11-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 20
20 b25Fixed
Related Reports
Relates :  
Description
From the Linux comment of os::open

  // O_CLOEXEC is preferable to using FD_CLOEXEC on an open file descriptor
  // because it saves a system call and removes a small window where the flag
  // is unset.  On ancient Linux kernels the O_CLOEXEC flag will be ignored
  // and we fall back to using FD_CLOEXEC (see below).

On macOS if __DARWIN_C_LEVEL >= 200809L then we have access to O_CLOEXEC and we should use it instead.

Comments
Changeset: ccc6e169 Author: Gerard Ziemski <gziemski@openjdk.org> Date: 2022-11-22 16:30:24 +0000 URL: https://git.openjdk.org/jdk/commit/ccc6e169188019dab008df5ffb11b4279e14f8fc
22-11-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/9663 Date: 2022-07-27 19:19:44 +0000
27-07-2022