[#BloombergLP-bdls-FilesystemUtil-map] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/FilesystemUtil.adoc[FilesystemUtil]::map :relfileprefix: ../../../ :mrdocs: 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, 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`. Note that on failure, the value of `address` is undefined. Also note that mapping will succeed even if there are fewer than `offset + size` bytes in the specified file, and an attempt to access the mapped memory beyond the end of the file will result in undefined behavior (i.e., this function does not grow the file to guarantee it can accommodate the mapped region). Also note that mapping past the end of file may return 0, but any access of the resulting mapped memory may segfault. == Synopsis Declared in `<bdls_filesystemutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int map( xref:BloombergLP/bdls/FilesystemUtil/FileDescriptor.adoc[FileDescriptor] descriptor, void** address, xref:BloombergLP/bdls/FilesystemUtil/Offset.adoc[Offset] offset, std::size_t size, int mode); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#