| 235 | } |
| 236 | |
| 237 | int lwp_pgrp_move(rt_processgroup_t group, rt_lwp_t process) |
| 238 | { |
| 239 | int retry = 1; |
| 240 | rt_processgroup_t old_group; |
| 241 | |
| 242 | /* parameter check */ |
| 243 | if (group == RT_NULL || process == RT_NULL) |
| 244 | { |
| 245 | return -EINVAL; |
| 246 | } |
| 247 | |
| 248 | if (lwp_pgid_get_bypgrp(group) == lwp_pgid_get_byprocess(process)) |
| 249 | { |
| 250 | return 0; |
| 251 | } |
| 252 | |
| 253 | PGRP_LOCK(group); |
| 254 | while (retry) |
| 255 | { |
| 256 | retry = 0; |
| 257 | old_group = lwp_pgrp_find_and_inc_ref(lwp_pgid_get_byprocess(process)); |
| 258 | |
| 259 | PGRP_LOCK(old_group); |
| 260 | LWP_LOCK(process); |
| 261 | |
| 262 | if (process->pgrp == old_group) |
| 263 | { |
| 264 | lwp_pgrp_remove(old_group, process); |
| 265 | lwp_pgrp_insert(group, process); |
| 266 | } |
| 267 | else |
| 268 | { |
| 269 | retry = 1; |
| 270 | } |
| 271 | PGRP_UNLOCK(old_group); |
| 272 | LWP_UNLOCK(process); |
| 273 | |
| 274 | lwp_pgrp_dec_ref(old_group); |
| 275 | } |
| 276 | PGRP_UNLOCK(group); |
| 277 | |
| 278 | return 0; |
| 279 | } |
| 280 | |
| 281 | int lwp_pgrp_update_children_info(rt_processgroup_t group, pid_t sid, pid_t pgid) |
| 282 | { |
no test coverage detected