| 410 | */ |
| 411 | |
| 412 | static struct sem_undo * |
| 413 | semu_alloc(struct thread *td) |
| 414 | { |
| 415 | struct sem_undo *suptr; |
| 416 | |
| 417 | SEMUNDO_LOCKASSERT(MA_OWNED); |
| 418 | if ((suptr = LIST_FIRST(&semu_free_list)) == NULL) |
| 419 | return (NULL); |
| 420 | LIST_REMOVE(suptr, un_next); |
| 421 | LIST_INSERT_HEAD(&semu_list, suptr, un_next); |
| 422 | suptr->un_cnt = 0; |
| 423 | suptr->un_proc = td->td_proc; |
| 424 | return (suptr); |
| 425 | } |
| 426 | |
| 427 | static int |
| 428 | semu_try_free(struct sem_undo *suptr) |