| Function report | 
| Source Code: kernel\pid.c | Create Date:2022-07-28 09:28:37 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:alloc_pid
Proto:struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid, size_t set_tid_size)
Type:struct pid
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct pid_namespace * | ns | |
| pid_t * | set_tid | |
| size_t | set_tid_size | 
| 178 | If set_tid_size > level + 1 Then Return ERR_PTR( - EINVAL) | 
| 181 | pid = kmem_cache_alloc(pid_cachep, GFP_KERNEL) | 
| 189 | tid = 0 | 
| 191 | If set_tid_size Then | 
| 201 | If tid != 1 && Not child_reaper Then Go to out_free | 
| 204 | If Not ns_capable(user_ns, Allow setting zone reclaim policy ) Then Go to out_free | 
| 206 | set_tid_size-- | 
| 210 | spin_lock_irq( & Note: disable interrupts while the pidmap_lock is held as an* interrupt might come in and do read_lock(&tasklist_lock)) | 
| 212 | If tid Then | 
| 221 | Else | 
| 222 | pid_min = 1 | 
| 237 | spin_unlock_irq( & Note: disable interrupts while the pidmap_lock is held as an* interrupt might come in and do read_lock(&tasklist_lock)) | 
| 240 | If nr < 0 Then | 
| 251 | If pid_ns_prepare_proc(ns) Then Go to out_free | 
| 255 | get_pid_ns(ns) | 
| 257 | When type < PIDTYPE_MAX cycle INIT_HLIST_HEAD( & lists of tasks that use this pid [type]) | 
| 263 | spin_lock_irq( & Note: disable interrupts while the pidmap_lock is held as an* interrupt might come in and do read_lock(&tasklist_lock)) | 
| 264 | If Not (pid_allocated & PIDNS_ADDING) Then Go to out_unlock | 
| 271 | spin_unlock_irq( & Note: disable interrupts while the pidmap_lock is held as an* interrupt might come in and do read_lock(&tasklist_lock)) | 
| 273 | Return pid | 
| 275 | out_unlock : | 
| 276 | spin_unlock_irq( & Note: disable interrupts while the pidmap_lock is held as an* interrupt might come in and do read_lock(&tasklist_lock)) | 
| 277 | put_pid_ns(ns) | 
| 279 | out_free : | 
| 280 | spin_lock_irq( & Note: disable interrupts while the pidmap_lock is held as an* interrupt might come in and do read_lock(&tasklist_lock)) | 
| 290 | spin_unlock_irq( & Note: disable interrupts while the pidmap_lock is held as an* interrupt might come in and do read_lock(&tasklist_lock)) | 
| 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 |