Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8238161

use os::fopen in HS code where possible

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 19
    • 15
    • hotspot
    • b05
    • generic
    • generic

      There exists a function os::fopen in HS code . This function sets "close-on-exec" flags (when possible) to the opened filedescriptor.
      It might have some benefits to use os::fopen more in HS code, currently there are still quite a few calls directly to fopen .

      see also the thread
      https://mail.openjdk.java.net/pipermail/hotspot-dev/2020-January/040641.html
      on hotspot-dev about the topic.

      Comment from Thomas Stuefe :
      Just a note, it is still possible for file descriptors to escape into child processes since you cannot guarantee that all forks happen via Runtime.exec():
      - native third party code may fork.
      - hotspot may fork to run tools for error reporting

      Also note that the code which closes fds in Runtime.exec() may in theory fail to close all fds.

            hseigel Harold Seigel (Inactive)
            mbaesken Matthias Baesken
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: