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

Function fget_cap_locked

freebsd/kern/kern_descrip.c:2950–2979  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2948}
2949
2950int
2951fget_cap_locked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
2952 struct file **fpp, struct filecaps *havecapsp)
2953{
2954 struct filedescent *fde;
2955 int error;
2956
2957 FILEDESC_LOCK_ASSERT(fdp);
2958
2959 fde = fdeget_locked(fdp, fd);
2960 if (fde == NULL) {
2961 error = EBADF;
2962 goto out;
2963 }
2964
2965#ifdef CAPABILITIES
2966 error = cap_check(cap_rights_fde_inline(fde), needrightsp);
2967 if (error != 0)
2968 goto out;
2969#endif
2970
2971 if (havecapsp != NULL)
2972 filecaps_copy(&fde->fde_caps, havecapsp, true);
2973
2974 *fpp = fde->fde_file;
2975
2976 error = 0;
2977out:
2978 return (error);
2979}
2980
2981int
2982fget_cap(struct thread *td, int fd, cap_rights_t *needrightsp,

Callers 1

fget_capFunction · 0.85

Calls 3

fdeget_lockedFunction · 0.85
cap_checkFunction · 0.85
filecaps_copyFunction · 0.85

Tested by

no test coverage detected