FRIDAY, SEPTEMBER 18, 2026
cobol
Cobol defers file status check errors to mmap
Cobol file opening now defers fstat errors to mmap, preventing premature failures.
The Cobol compiler now defers error checking for fstat(2) and directory detection during file opening to the subsequent mmap(2) call. This change improves robustness by preventing premature failures on transient file status issues.
In Details
When opening files for Cobol copybooks, this change modifies the error handling strategy. Instead of immediately failing on fstat(2) errors or if the path refers to a directory, the system will defer these checks until the mmap(2) call, allowing for more resilient file access.
For Context
- fstat(2)
- A POSIX system call that retrieves status information about an open file descriptor, such as file type, size, and permissions.
- S_ISDIR
- A POSIX macro that checks if the file mode, as returned by
fstat, indicates a directory. - mmap(2)
- A POSIX system call that maps files or devices into memory, allowing them to be accessed as if they were in memory arrays. It is often used for efficient file I/O.