2018-08-29 06:53:12 +02:00
|
|
|
#ifndef MEMORY_H
|
|
|
|
#define MEMORY_H
|
|
|
|
|
2021-03-22 18:59:16 +01:00
|
|
|
#include <stdbool.h>
|
2018-08-29 06:53:12 +02:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2019-07-06 03:59:44 +02:00
|
|
|
#ifdef __linux__
|
|
|
|
#define HAVE_COMPATIBLE_MREMAP
|
|
|
|
#endif
|
|
|
|
|
2018-10-20 03:29:40 +02:00
|
|
|
int get_metadata_key(void);
|
|
|
|
|
2018-08-29 06:53:12 +02:00
|
|
|
void *memory_map(size_t size);
|
2021-03-22 18:59:16 +01:00
|
|
|
bool memory_map_fixed(void *ptr, size_t size);
|
|
|
|
bool memory_unmap(void *ptr, size_t size);
|
|
|
|
bool memory_protect_ro(void *ptr, size_t size);
|
|
|
|
bool memory_protect_rw(void *ptr, size_t size);
|
|
|
|
bool memory_protect_rw_metadata(void *ptr, size_t size);
|
2019-07-06 03:59:44 +02:00
|
|
|
#ifdef HAVE_COMPATIBLE_MREMAP
|
2021-03-22 18:59:16 +01:00
|
|
|
bool memory_remap(void *old, size_t old_size, size_t new_size);
|
|
|
|
bool memory_remap_fixed(void *old, size_t old_size, void *new, size_t new_size);
|
2019-07-06 03:59:44 +02:00
|
|
|
#endif
|
2021-03-22 18:59:16 +01:00
|
|
|
bool memory_purge(void *ptr, size_t size);
|
2018-12-11 18:37:37 +01:00
|
|
|
void memory_set_name(void *ptr, size_t size, const char *name);
|
2018-08-29 06:53:12 +02:00
|
|
|
|
|
|
|
#endif
|