- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does the Fortran standard say anything about setting the (Linux) O_CLOEXEC flag on files that are opened via the OPEN() intrinsic? It appears as though this flag is not set for any such calls when I do a "strace" on one of my Fortran programs. GNU gfortran appears to set that bit, but there's no citation as to whether that's a "just makes sense" change, or if there is a part of the standard that requires it. I would be surprised if it did though, because I don't believe Windows has that capability.
It would seem as though setting this flag would be something you'd want to do with Fortran, since there's no real easy way of passing I/O unit numbers across an exec() call (unless they were in the program arguments, but even calling exec() directly from Fortran seems overly onerous). Perhaps a compiler switch to alter this functionality in the RTL?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was unfamiliar with this option, but even after reading a description it's not clear to me. The reading I did suggested that the file was closed as soon as you did an exec(). I can't quite imagine why one would want that as a default in Fortran, but perhaps I misunderstand it. Perhaps you can set this in a USEROPEN routine?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"By default, file descriptors remain open across an execve(). File descriptors that are marked close-on-exec are closed; see the description of FD_CLOEXEC in fcntl(2)."
I would expect, as you note, with Fortran there would be no need to preserve these file descriptors across the exec. But it seems as though the current behavior is to leave them open in the new process space.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would guess that the issue never came to the attention of the Intel developers. If you have support, you could file a feature request.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page