Function utility::map_file_read_mode

Function Documentation

std::pair<int, void *> utility::map_file_read_mode(const std::string &file_name, void *const addr, const size_t length, const off_t offset, const int additional_flags = 0)

Maps a file with read mode.

Return
On Success, returns a pair of the file descriptor of the file and the starting address for the map. On error, retuns a pair of -1 and nullptr.
Parameters
  • file_name: The name of file to be mapped
  • addr: Normally nullptr; if this is not nullptr the kernel takes it as a hint about where to place the mapping
  • length: The length of the map
  • offset: The offset in the file