summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-01-13 12:57:02 +0000
committeralfred <alfred@FreeBSD.org>2002-01-13 12:57:02 +0000
commitb0764e3d9ae39199dd6b60e4dd916f0406c2eed2 (patch)
treecdb3deba3804dd672dc5e1e26a971f473c2b8073 /sys
parent9d8749dc98adcef57d3cb26217e2f2b9c4ac27da (diff)
downloadFreeBSD-src-b0764e3d9ae39199dd6b60e4dd916f0406c2eed2.zip
FreeBSD-src-b0764e3d9ae39199dd6b60e4dd916f0406c2eed2.tar.gz
Implement ffind_hold using ffind_lock.
Recommended by: jhb
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_descrip.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 1538698..ad89597 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1464,19 +1464,11 @@ ffind_hold(td, fd)
struct thread *td;
int fd;
{
- struct filedesc *fdp;
struct file *fp;
- if (td == NULL || (fdp = td->td_proc->p_fd) == NULL)
- return (NULL);
- FILEDESC_LOCK(fdp);
- if (fd < 0 || fd >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[fd]) == NULL ||
- fp->f_ops == &badfileops)
- fp = NULL;
- else
- fhold(fp);
- FILEDESC_UNLOCK(fdp);
+ fp = ffind_lock(td, fd);
+ if (fp != NULL)
+ FILE_UNLOCK(fp);
return (fp);
}
OpenPOWER on IntegriCloud