| 589 | } |
| 590 | |
| 591 | static int |
| 592 | ksem_get(struct thread *td, semid_t id, cap_rights_t *rightsp, |
| 593 | struct file **fpp) |
| 594 | { |
| 595 | struct ksem *ks; |
| 596 | struct file *fp; |
| 597 | int error; |
| 598 | |
| 599 | error = fget(td, id, rightsp, &fp); |
| 600 | if (error) |
| 601 | return (EINVAL); |
| 602 | if (fp->f_type != DTYPE_SEM) { |
| 603 | fdrop(fp, td); |
| 604 | return (EINVAL); |
| 605 | } |
| 606 | ks = fp->f_data; |
| 607 | if (ks->ks_flags & KS_DEAD) { |
| 608 | fdrop(fp, td); |
| 609 | return (EINVAL); |
| 610 | } |
| 611 | *fpp = fp; |
| 612 | return (0); |
| 613 | } |
| 614 | |
| 615 | /* System calls. */ |
| 616 | #ifndef _SYS_SYSPROTO_H_ |
no test coverage detected