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

Function fget_only_user

freebsd/kern/kern_descrip.c:3289–3316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3287 */
3288#ifdef CAPABILITIES
3289int
3290fget_only_user(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
3291 struct file **fpp)
3292{
3293 const struct filedescent *fde;
3294 const struct fdescenttbl *fdt;
3295 const cap_rights_t *haverights;
3296 struct file *fp;
3297 int error;
3298
3299 MPASS(FILEDESC_IS_ONLY_USER(fdp));
3300
3301 if (__predict_false(fd >= fdp->fd_nfiles))
3302 return (EBADF);
3303
3304 fdt = fdp->fd_files;
3305 fde = &fdt->fdt_ofiles[fd];
3306 fp = fde->fde_file;
3307 if (__predict_false(fp == NULL))
3308 return (EBADF);
3309 MPASS(refcount_load(&fp->f_count) > 0);
3310 haverights = cap_rights_fde_inline(fde);
3311 error = cap_check_inline(haverights, needrightsp);
3312 if (__predict_false(error != 0))
3313 return (EBADF);
3314 *fpp = fp;
3315 return (0);
3316}
3317#else
3318int
3319fget_only_user(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,

Callers 4

selrescanFunction · 0.85
selscanFunction · 0.85
pollrescanFunction · 0.85
pollscanFunction · 0.85

Calls 2

refcount_loadFunction · 0.85
cap_check_inlineFunction · 0.85

Tested by

no test coverage detected