use os::fopen in HS code where possible

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P3
    • 19
    • Affects Version/s: 15
    • Component/s: 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.

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

              Created:
              Updated:
              Resolved: