Function report |
Source Code:mm\mmap.c |
Create Date:2022-07-28 14:48:23 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:The caller must hold down_write(¤t->mm->mmap_sem).
Proto:unsigned long do_mmap(struct file *file, unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, vm_flags_t vm_flags, unsigned long pgoff, unsigned long *populate, struct list_head *uf)
Type:unsigned long
Parameter:
Type | Parameter | Name |
---|---|---|
struct file * | file | |
unsigned long | addr | |
unsigned long | len | |
unsigned long | prot | |
unsigned long | flags | |
vm_flags_t | vm_flags | |
unsigned long | pgoff | |
unsigned long * | populate | |
struct list_head * | uf |
1374 | pkey = 0 |
1376 | populate = 0 |
1387 | If prot & page can be read && personality & READ_IMPLIES_EXEC Then If Not (file && path_noexec( & f_path)) Then |
1389 | prot |= page can be executed |
1392 | If flags & MAP_FIXED which doesn't unmap underlying mapping Then flags |= Interpret addr exactly |
1395 | If Not (flags & Interpret addr exactly ) Then addr = If a hint addr is less than mmap_min_addr change hint to be as* low as possible but still greater than mmap_min_addr |
1404 | If pgoff + (len >> PAGE_SHIFT determines the page size ) < pgoff Then Return -EOVERFLOW |
1408 | If number of VMAs > sysctl_max_map_count Then Return -ENOMEM |
1415 | If IS_ERR_VALUE(addr) Then Return addr |
1418 | If flags & MAP_FIXED which doesn't unmap underlying mapping Then |
1421 | If vma && Our start address within vm_mm. < addr + len Then Return -EEXIST |
1425 | If prot == page can be executed Then |
1426 | pkey = execute_only_pkey(mm) |
1438 | If flags & pages are locked Then If Not can_do_mlock() Then |
1440 | Return -EPERM |
1442 | If mlock_future_check(mm, vm_flags, len) Then Return -EAGAIN |
1445 | If file Then |
1446 | inode = file_inode(file) |
1452 | flags_mask = The historical set of flags that all mmap implementations implicitly* support when a ->mmap_validate() op is not provided in file_operations. | mmap_supported_flags |
1455 | Case & == Share changes |
1465 | Case & == share + validate extension flags |
1466 | If flags & ~flags_mask Then Return -EOPNOTSUPP |
1468 | If prot & page can be written Then |
1469 | If Not (f_mode & le is open for writing ) Then Return -EACCES |
1471 | If IS_SWAPFILE(host) Then Return -ETXTBSY |
1479 | If IS_APPEND(inode) && f_mode & le is open for writing Then Return -EACCES |
1485 | If locks_verify_locked(file) Then Return -EAGAIN |
1488 | vm_flags |= VM_SHARED | VM_MAYSHARE |
1489 | If Not (f_mode & le is open for writing ) Then vm_flags &= ~(VM_MAYWRITE | VM_SHARED) |
1493 | Case & == Changes are private |
1494 | If Not (f_mode & le is open for reading ) Then Return -EACCES |
1496 | If path_noexec( & f_path) Then |
1499 | vm_flags &= ~VM_MAYEXEC |
1504 | If vm_flags & (general info on the segment | VM_GROWSUP) Then Return -EINVAL |
1506 | Break |
1508 | Default |
1509 | Return -EINVAL |
1511 | Else |
1513 | Case & == Share changes |
1514 | If vm_flags & (general info on the segment | VM_GROWSUP) Then Return -EINVAL |
1519 | pgoff = 0 |
1520 | vm_flags |= VM_SHARED | VM_MAYSHARE |
1521 | Break |
1522 | Case & == Changes are private |
1526 | pgoff = addr >> PAGE_SHIFT determines the page size |
1527 | Break |
1528 | Default |
1529 | Return -EINVAL |
1537 | If flags & don't check for reservations Then |
1539 | If sysctl_overcommit_memory != OVERCOMMIT_NEVER Then vm_flags |= should the VM suppress accounting |
1543 | If file && is_file_hugepages(file) Then vm_flags |= should the VM suppress accounting |
1548 | If Not IS_ERR_VALUE(addr) && ( vm_flags & VM_LOCKED || (flags & (populate (prefault) pagetables | do not block on IO )) == populate (prefault) pagetables ) Then populate = len |
1552 | Return addr |
Name | Describe |
---|---|
do_mmap_pgoff |
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 |