git: b937908e41d7 - main - fd: split fget_cap depending on CAPABILITIES
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 11 Feb 2022 13:58:02 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b937908e41d7d1b33e062edc02f04980a2b8732e commit b937908e41d7d1b33e062edc02f04980a2b8732e Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2022-02-11 11:45:57 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2022-02-11 12:13:27 +0000 fd: split fget_cap depending on CAPABILITIES This will simplify an upcoming change. --- sys/kern/kern_descrip.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index c4cf9abde664..84622e163503 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2868,17 +2868,13 @@ out: return (error); } +#ifdef CAPABILITIES int fget_cap(struct thread *td, int fd, cap_rights_t *needrightsp, struct file **fpp, struct filecaps *havecapsp) { struct filedesc *fdp = td->td_proc->p_fd; int error; -#ifndef CAPABILITIES - error = fget_unlocked(fdp, fd, needrightsp, fpp); - if (havecapsp != NULL && error == 0) - filecaps_fill(havecapsp); -#else struct file *fp; seqc_t seq; @@ -2910,9 +2906,23 @@ get_locked: if (error == 0 && !fhold(*fpp)) error = EBADF; FILEDESC_SUNLOCK(fdp); -#endif return (error); } +#else +int +fget_cap(struct thread *td, int fd, cap_rights_t *needrightsp, + struct file **fpp, struct filecaps *havecapsp) +{ + struct filedesc *fdp = td->td_proc->p_fd; + int error; + + error = fget_unlocked(fdp, fd, needrightsp, fpp); + if (havecapsp != NULL && error == 0) + filecaps_fill(havecapsp); + + return (error); +} +#endif #ifdef CAPABILITIES int