| 574 | } |
| 575 | |
| 576 | int |
| 577 | sys_cap_fcntls_limit(struct thread *td, struct cap_fcntls_limit_args *uap) |
| 578 | { |
| 579 | struct filedesc *fdp; |
| 580 | struct filedescent *fdep; |
| 581 | uint32_t fcntlrights; |
| 582 | int fd; |
| 583 | |
| 584 | fd = uap->fd; |
| 585 | fcntlrights = uap->fcntlrights; |
| 586 | |
| 587 | AUDIT_ARG_FD(fd); |
| 588 | AUDIT_ARG_FCNTL_RIGHTS(fcntlrights); |
| 589 | |
| 590 | if ((fcntlrights & ~CAP_FCNTL_ALL) != 0) |
| 591 | return (EINVAL); |
| 592 | |
| 593 | fdp = td->td_proc->p_fd; |
| 594 | FILEDESC_XLOCK(fdp); |
| 595 | |
| 596 | fdep = fdeget_locked(fdp, fd); |
| 597 | if (fdep == NULL) { |
| 598 | FILEDESC_XUNLOCK(fdp); |
| 599 | return (EBADF); |
| 600 | } |
| 601 | |
| 602 | if ((fcntlrights & ~fdep->fde_fcntls) != 0) { |
| 603 | FILEDESC_XUNLOCK(fdp); |
| 604 | return (ENOTCAPABLE); |
| 605 | } |
| 606 | |
| 607 | seqc_write_begin(&fdep->fde_seqc); |
| 608 | fdep->fde_fcntls = fcntlrights; |
| 609 | seqc_write_end(&fdep->fde_seqc); |
| 610 | FILEDESC_XUNLOCK(fdp); |
| 611 | |
| 612 | return (0); |
| 613 | } |
| 614 | |
| 615 | int |
| 616 | sys_cap_fcntls_get(struct thread *td, struct cap_fcntls_get_args *uap) |
nothing calls this directly
no test coverage detected