How to get memory access type in C / C ++ on Linux

Possible duplicate:
Is there a better way than parsing / proc / self / maps to determine memory protection?

I have a pointer and I want to check if the referenced memory is available, writable and / or executable. How can i do this?

0


source to share


1 answer


You will have to analyze the file /proc/self/maps

that contains the memory mappings of your process and check which of the mappings are within the value of your pointer (if any). The file /proc/self/maps

contains memory protection (read / write / execute).



For more details on the map file see this question .

+1


source







All Articles