Map the region of the specified size bytes, starting at the specified offset bytes into the file with the specified descriptor to memory, and load into the specified address of the mapped area. Return 0 on success, k_ERROR_PAST_EOF if an attempt is made to map past the end of file, and a non‐zero value otherwise. The access permissions for mapping memory are defined by the specified mode, which may be a combination of MemoryUtil::k_ACCESS_READ, MemoryUtil::k_ACCESS_WRITE and MemoryUtil::k_ACCESS_EXECUTE, though on some platforms they must be a subset of the file permissions. The behavior is undefined unless bits in mode other than MemoryUtil::k_ACCESS_READ_WRITE_EXECUTE are all clear, unless 0 <= offset, and unless 0 < size, and unless the offset is a multiple of MemoryUtil::pageSize(). Note that on failure, the value of address is undefined. Also note that the check against mapping past the end of file and all assertions are done before the call to map the file.

Synopsis

Declared in <bdls_filesystemutil.h>

static
int
mapChecked(
    FileDescriptor descriptor,
    void** address,
    Offset offset,
    std::size_t size,
    int mode);

Created with MrDocs