Function report |
Source Code:mm\mmap.c |
Create Date:2022-07-28 14:48:44 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:mmap_region
Proto:unsigned long mmap_region(struct file *file, unsigned long addr, unsigned long len, vm_flags_t vm_flags, unsigned long pgoff, struct list_head *uf)
Type:unsigned long
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct file * | file | |
| unsigned long | addr | |
| unsigned long | len | |
| vm_flags_t | vm_flags | |
| unsigned long | pgoff | |
| struct list_head * | uf |
| 1697 | charged = 0 |
| 1709 | If Not Return true if the calling process may expand its vm space by the passed* number of pages Then Return -ENOMEM |
| 1725 | charged = len >> PAGE_SHIFT determines the page size |
| 1726 | If security_vm_enough_memory_mm(mm, charged) Then Return -ENOMEM |
| 1728 | vm_flags |= Is a VM accounted object |
| 1734 | vma = Given a mapping request (addr,end,vm_flags,file,pgoff), figure out* whether that can be merged with its predecessor or its successor |
| 1744 | vma = vm_area_alloc(mm) |
| 1745 | If Not vma Then |
| 1747 | Go to unacct_error |
| 1752 | Flags, see mm.h. = vm_flags |
| 1756 | If file Then |
| 1757 | If vm_flags & ETXTBSY on write attempts.. Then |
| 1758 | error = deny_write_access(file) |
| 1763 | error = mapping_map_writable(f_mapping) |
| 1764 | If error Then Go to allow_write_and_free_vma |
| 1775 | If error Then Go to unmap_and_free_vma |
| 1785 | WARN_ON_ONCE(addr != Our start address within vm_mm. ) |
| 1788 | vm_flags = Flags, see mm.h. |
| 1793 | Else |
| 1794 | vma_set_anonymous(vma) |
| 1799 | If file Then |
| 1800 | If vm_flags & VM_SHARED Then mapping_unmap_writable(f_mapping) |
| 1802 | If vm_flags & ETXTBSY on write attempts.. Then allow_write_access(file) |
| 1806 | out : |
| 1807 | perf_event_mmap(vma) |
| 1809 | vm_stat_account(mm, vm_flags, len >> PAGE_SHIFT determines the page size ) |
| 1815 | Else Pages that have PG_mlocked set += len >> PAGE_SHIFT determines the page size |
| 1819 | If file Then Called from mmap_region/vma_adjust with mm->mmap_sem acquired.* Currently we ignore all errors and always return 0, the callers* can't handle the failure anyway. |
| 1829 | Flags, see mm.h. |= VM_SOFTDIRTY |
| 1833 | Return addr |
| 1835 | unmap_and_free_vma : |
| 1836 | File we map to (can be NULL). = NULL |
| 1840 | unmap_region(mm, vma, prev, Our start address within vm_mm. , The first byte after our end addresswithin vm_mm. ) |
| 1841 | charged = 0 |
| 1842 | If vm_flags & VM_SHARED Then mapping_unmap_writable(f_mapping) |
| 1844 | allow_write_and_free_vma : |
| 1845 | If vm_flags & ETXTBSY on write attempts.. Then allow_write_access(file) |
| 1847 | free_vma : |
| 1848 | vm_area_free(vma) |
| 1849 | unacct_error : |
| 1850 | If charged Then vm_unacct_memory(charged) |
| 1852 | Return error |
| Name | Describe |
|---|---|
| do_mmap | The caller must hold down_write(¤t->mm->mmap_sem). |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |