Function report |
Source Code:ipc\shm.c |
Create Date:2022-07-28 16:48:29 |
| Last Modify:2020-03-17 22:58:32 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Fix shmaddr, allocate descriptor, map shm, add attach descriptor to lists.* NOTE! Despite the name, this is NOT a direct system call entrypoint. The* "raddr" thing points to kernel space, and there has to be a wrapper around* this.
Proto:long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr, unsigned long shmlba)
Type:long
Parameter:
| Type | Parameter | Name |
|---|---|---|
| int | shmid | |
| char __user * | shmaddr | |
| int | shmflg | |
| ulong * | raddr | |
| unsigned long | shmlba |
| 1426 | flags = Share changes |
| 1432 | populate = 0 |
| 1438 | If addr Then |
| 1440 | If shmflg & und attach address to SHMLBA boundary Then |
| 1454 | Go to out |
| 1457 | flags |= Interpret addr exactly |
| 1458 | Else if shmflg & ake-over region on attach Then Go to out |
| 1461 | If shmflg & ad-only access Then |
| 1465 | Else |
| 1466 | prot = page can be read | page can be written |
| 1470 | If shmflg & xecution access Then |
| 1471 | prot |= page can be executed |
| 1481 | shp = shm_obtain_object_check(ns, shmid) |
| 1484 | Go to out_unlock |
| 1491 | err = security_shm_shmat( & shm_perm, shmaddr, shmflg) |
| 1492 | If err Then Go to out_unlock |
| 1495 | ipc_lock_object( & shm_perm) |
| 1514 | shm_nattch++ |
| 1516 | ipc_unlock_object( & shm_perm) |
| 1520 | sfd = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 1521 | If Not sfd Then |
| 1523 | Go to out_nattch |
| 1538 | ns = get_ipc_ns(ns) |
| 1540 | vm_ops = NULL |
| 1543 | err = security_mmap_file(file, prot, flags) |
| 1547 | If lock for writing Then |
| 1552 | If addr && Not (shmflg & ake-over region on attach ) Then |
| 1563 | err = 0 |
| 1564 | If IS_ERR_VALUE(addr) Then err = addr |
| 1566 | invalid : |
| 1567 | lease a write lock |
| 1568 | If populate Then mm_populate(addr, populate) |
| 1571 | out_fput : |
| 1574 | out_nattch : |
| 1575 | lock for writing |
| 1576 | shp = shm_lock_(check_) routines are called in the paths where the rwsem* is not necessarily held. |
| 1577 | shm_nattch-- |
| 1580 | Else shm_unlock(shp) |
| 1582 | lease a write lock |
| 1583 | Return err |
| 1585 | out_unlock : |
| 1587 | out : |
| 1588 | Return err |
| Name | Describe |
|---|---|
| SYSCALL_DEFINE3 | |
| COMPAT_SYSCALL_DEFINE3 | |
| ksys_ipc |
| 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 |