add support for labelling memory regions
This commit is contained in:
15
memory.c
15
memory.c
@ -1,6 +1,15 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/prctl.h>
|
||||
|
||||
#ifndef PR_SET_VMA
|
||||
#define PR_SET_VMA 0x53564d41
|
||||
#endif
|
||||
|
||||
#ifndef PR_SET_VMA_ANON_NAME
|
||||
#define PR_SET_VMA_ANON_NAME 0
|
||||
#endif
|
||||
|
||||
#include "memory.h"
|
||||
#include "util.h"
|
||||
@ -80,3 +89,9 @@ int memory_remap_fixed(void *old, size_t old_size, void *new, size_t new_size) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void memory_set_name(UNUSED void *ptr, UNUSED size_t size, UNUSED const char *name) {
|
||||
#ifdef LABEL_MEMORY
|
||||
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, ptr, size, name);
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user