Two signals are associated with mapped regions: SIGBUS
SIGSEGV
munmap() Linux provides the munmap() system call for removing a mapping created with mmap():
#include <sys/mman.h> int munmap (void *addr, size_t len); A call to munmap() removes any mappings that contain pages located anywhere in the process address space starting at addr, which must be page-aligned, and continuing forlenbytes. Once the mapping has been removed, the previously associated memory region is no longer valid, and further access attempts result in aSIGSEGVsignal. Normally,munmap()is passed the return value and thelenparameter from a previous invocation ofmmap(). On success,munmap()returns0; on failure, it returns As an example, the following snippet unmaps any memory regions with pages contained in the interval[addr,addr+len]: if (munmap (addr, len) == -1) Please check back next week for the continuation of this article.
blog comments powered by Disqus |