C++: modules: Allow for EOPNOTSUPP error from posix_fallocate
Fixes C++ module compilation SEGV on NetBSD by handling EOPNOTSUPP from posix_fallocate.
This commit resolves a segmentation fault occurring during C++ module compilation on NetBSD when using a ZFS build directory. It addresses an issue where posix_fallocate returns EOPNOTSUPP, an error code not previously handled. The change updates elf_out::create_mapping to accommodate this error, preventing the crash and ensuring module compilation proceeds correctly.
In Details
This change updates C++ module support in cp/module.cc to handle EOPNOTSUPP from posix_fallocate, which occurs on NetBSD in ZFS directories. It adds a fallback definition for EOPNOTSUPP and modifies the elf_out::create_mapping function to accept this error code, aligning with behavior seen on FreeBSD and preventing segfaults.
- EOPNOTSUPP
- An error code indicating that an operation is not supported. In this context, it's returned by posix_fallocate when the filesystem does not support pre-allocation of space.
- posix_fallocate
- A function that proactively allocates disk space for a file, improving performance by reducing fragmentation. It's part of the POSIX standard for file operations.
- SEGV
- Segmentation fault, a common runtime error occurring when a program attempts to access a memory location that it's not allowed to access. This often indicates a bug in the program's memory management.