diff options
author | alfred <alfred@FreeBSD.org> | 2002-01-23 08:22:59 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2002-01-23 08:22:59 +0000 |
commit | 8ea3c5cdda849bde37cfbffc0f60b87dcb8a8d0e (patch) | |
tree | 864f63c8c22ac9d45af796a30a10483553cb1a2c | |
parent | f481b3ebda0997395e98a9c6bb2a47376dda3833 (diff) | |
download | FreeBSD-src-8ea3c5cdda849bde37cfbffc0f60b87dcb8a8d0e.zip FreeBSD-src-8ea3c5cdda849bde37cfbffc0f60b87dcb8a8d0e.tar.gz |
make pread use fget_read instead of holdfp.
-rw-r--r-- | sys/kern/sys_generic.c | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 0a900b6..0c2ea23 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -83,30 +83,6 @@ static int dofileread __P((struct thread *, struct file *, int, void *, static int dofilewrite __P((struct thread *, struct file *, int, const void *, size_t, off_t, int)); -struct file* -holdfp(fdp, fd, flag) - struct filedesc* fdp; - int fd, flag; -{ - struct file* fp; - - FILEDESC_LOCK(fdp); - if (((u_int)fd) >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[fd]) == NULL) { - FILEDESC_UNLOCK(fdp); - return (NULL); - } - FILE_LOCK(fp); - FILEDESC_UNLOCK(fdp); - if ((fp->f_flag & flag) == 0) { - FILE_UNLOCK(fp); - return (NULL); - } - fp->f_count++; - FILE_UNLOCK(fp); - return (fp); -} - /* * Read system call. */ @@ -161,9 +137,8 @@ pread(td, uap) struct file *fp; int error; - fp = holdfp(td->td_proc->p_fd, uap->fd, FREAD); - if (fp == NULL) - return (EBADF); + if ((error = fget_read(td, uap->fd, &fp)) != 0) + return (error); mtx_lock(&Giant); if (fp->f_type != DTYPE_VNODE) { error = ESPIPE; |