MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sys_cap_fcntls_limit

Function sys_cap_fcntls_limit

freebsd/kern/sys_capability.c:576–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574}
575
576int
577sys_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
615int
616sys_cap_fcntls_get(struct thread *td, struct cap_fcntls_get_args *uap)

Callers

nothing calls this directly

Calls 3

fdeget_lockedFunction · 0.85
seqc_write_beginFunction · 0.85
seqc_write_endFunction · 0.85

Tested by

no test coverage detected