HOG2
Macros | Functions
MMapUtil.cpp File Reference
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <cinttypes>
Include dependency graph for MMapUtil.cpp:

Go to the source code of this file.

Macros

#define MAP_ANONYMOUS   MAP_ANON
 
#define handle_error(msg)   do { perror(msg); exit(EXIT_FAILURE); } while (0)
 

Functions

uint8_t * GetMMAP (const char *filename, uint64_t mapSize, int &fd, bool zero)
 
void CloseMMap (uint8_t *mem, uint64_t mapSizeBytes, int fd)
 

Macro Definition Documentation

◆ handle_error

#define handle_error (   msg)    do { perror(msg); exit(EXIT_FAILURE); } while (0)

Definition at line 25 of file MMapUtil.cpp.

◆ MAP_ANONYMOUS

#define MAP_ANONYMOUS   MAP_ANON

Definition at line 22 of file MMapUtil.cpp.

Function Documentation

◆ CloseMMap()

void CloseMMap ( uint8_t *  mem,
uint64_t  mapSizeBytes,
int  fd 
)

Definition at line 85 of file MMapUtil.cpp.

References handle_error.

◆ GetMMAP()

uint8_t* GetMMAP ( const char *  filename,
uint64_t  mapSize,
int &  fd,
bool  zero 
)

Definition at line 28 of file MMapUtil.cpp.

References handle_error, and MAP_ANONYMOUS.