1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-26 16:18:31 +00:00

Implement ffind_hold using ffind_lock.

Recommended by: jhb
This commit is contained in:
Alfred Perlstein 2002-01-13 12:57:02 +00:00
parent da10530228
commit c2824dd49b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=89309

View File

@ -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);
}