| 44 | } |
| 45 | |
| 46 | rt_processgroup_t lwp_pgrp_find(pid_t pgid) |
| 47 | { |
| 48 | rt_base_t level; |
| 49 | rt_processgroup_t group = RT_NULL; |
| 50 | rt_list_t *node = RT_NULL; |
| 51 | struct rt_object_information *information = RT_NULL; |
| 52 | |
| 53 | information = rt_object_get_information(RT_Object_Class_ProcessGroup); |
| 54 | |
| 55 | /* parameter check */ |
| 56 | if ((pgid < 0) || (information == RT_NULL)) |
| 57 | { |
| 58 | return RT_NULL; |
| 59 | } |
| 60 | |
| 61 | if (pgid == 0) |
| 62 | { |
| 63 | pgid = lwp_getpid(); |
| 64 | } |
| 65 | |
| 66 | /* enter critical */ |
| 67 | level = rt_spin_lock_irqsave(&(information->spinlock)); |
| 68 | |
| 69 | /* try to find process group */ |
| 70 | rt_list_for_each(node, &(information->object_list)) |
| 71 | { |
| 72 | group = (rt_processgroup_t)rt_list_entry(node, struct rt_object, list); |
| 73 | if (group->pgid == pgid) |
| 74 | { |
| 75 | rt_spin_unlock_irqrestore(&(information->spinlock), level); |
| 76 | |
| 77 | return group; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | rt_spin_unlock_irqrestore(&(information->spinlock), level); |
| 82 | |
| 83 | LOG_I("cannot find(pgid:%d)() by (pid:%d, pgid:%d)", pgid, lwp_getpid(), lwp_pgid_get_byprocess(lwp_self())); |
| 84 | |
| 85 | return RT_NULL; |
| 86 | } |
| 87 | |
| 88 | rt_processgroup_t lwp_pgrp_create(rt_lwp_t leader) |
| 89 | { |
no test coverage detected