munmap.2
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 2 代码 · 共 91 行
2
91 行
.TH munmap 2.SH Namemunmap \- unmaps memory of a character device.SH Syntax#include <sys/types.h>.br#include <sys/mman.h>.nfcaddr_t munmap(\fIaddr\fP, \fIlen\fP)caddr_t \fIaddr\fP;size_t \fIlen\fP;.fi.SH Arguments.TP 10\fIaddr\fPSpecifies the address space of the calling process at which the unmappingbegins..TP 10\fIlen\fPSpecifies the number of bytes to unmap..SH Description.NXR "munmap call".NXR "memory unmapping" "munmap call"The.PN munmapsystem call unmaps a specified number of bytes (\fIlen\fP)starting at a specified address(\fIaddr\fP)from the address space of the calling process.You mapped this device in a previous call to.PN mmap .Subsequent access to the unmapped region results in a .PN SIGSEGVsignal.You cannot unmapdata, stack, and text segments using.PN munmap ..PPThe.PN munmapsystem callrounds\fIlen\fPto the nearest multiple of page size as returned by.PN getpagesize ..PPThe range [\fIaddr\fP, \fIaddr\fP + \fIlen\fP] may contain more than onemapped region created by.PN mmap .In this case,.PN munmapunmaps all of the mapped regions..SH RestrictionsAll of the mapped regions must be wholly contained in the range[\fIaddr\fP, \fIaddr\fP + \fIlen\fP].That is,\fIaddr\fPmust be the beginning of some mapped region and\fIaddr\fP + \fIlen\fPmust be the end of some (possibly different) mapped region..SH Return ValueIf successful,.PN munmapreturns 0.Otherwise, it returns \-1and sets the\fIerrno\fPargument to one of the errors listed in the Diagnostics section..SH DiagnosticsThe call to.PN munmap fails if one or more of the following is true:.TP 10[EINVAL]The address you specified in\fIaddr\fPis not a multiple of the page size as returned by.PN getsysinfo ..TP 10[EINVAL]The addresses in the range [\fIaddr\fP, \fIaddr\fP + \fIlen\fP] are notvalid in the process address space..TP 10[EINVAL]All of the segments being unmapped are not entirely contained in therange [\fIaddr\fP, \fIaddr\fP + \fIlen\fP]. .SH See Alsogetpagesize(2), getsysinfo(2), mmap(2)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?