Function report |
Source Code:ipc\shm.c |
Create Date:2022-07-28 16:47:13 |
Last Modify:2020-03-17 22:58:32 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:wseg - Create a new shared memory segment*@ns: namespace*@params: ptr to the structure that contains key, size and shmflg* Called with shm_ids.rwsem held as a writer.
Proto:static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct ipc_namespace * | ns | |
struct ipc_params * | params |
604 | size = for shared memories |
607 | numpages = size + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size |
610 | acctflag = 0 |
612 | If size < min shared seg size (bytes) || size > shm_ctlmax Then Return -EINVAL |
615 | If numpages << PAGE_SHIFT determines the page size < size Then Return -ENOSPC |
622 | shp = kvmalloc( size of shp , GFP_KERNEL) |
623 | If Value for the false possibility is greater at compile time(!shp) Then Return -ENOMEM |
628 | mlock_user = NULL |
630 | security = NULL |
631 | error = security_shm_alloc( & shm_perm) |
632 | If error Then |
634 | Return error |
638 | If shmflg & segment will use huge TLB pages Then |
642 | hs = hstate_sizelog((shmflg >> Huge page size encoding when SHM_HUGETLB is specified, and a huge page* size other than the default is desired. See hugetlb_encode.h) & SHM_HUGE_MASK) |
643 | If Not hs Then |
647 | hugesize = @a is a power of 2 value (size, huge_page_size(hs)) |
650 | If shmflg & don't check for reservations Then acctflag = should the VM suppress accounting |
655 | Else |
669 | shm_cprid = get_pid(task_tgid(current process)) |
670 | shm_lprid = NULL |
674 | shm_nattch = 0 |
679 | error = pc_addid - add an ipc identifier*@ids: ipc identifier set*@new: new ipc permission set*@limit: limit for the number of used ids* Add an entry 'new' to the ipc ids idr |
694 | ipc_unlock_object( & shm_perm) |
696 | Return error |
698 | no_id : |
699 | ipc_update_pid( & shm_cprid, NULL) |
700 | ipc_update_pid( & shm_lprid, NULL) |
701 | If is_file_hugepages(file) && mlock_user Then user_shm_unlock(size, mlock_user) |
704 | ipc_rcu_putref( & shm_perm, shm_rcu_free) |
705 | Return error |
706 | no_file : |
708 | Return error |
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 |