diff options
author | dillon <dillon@FreeBSD.org> | 2001-11-14 06:30:36 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2001-11-14 06:30:36 +0000 |
commit | e3b965f7d57557c7273b062793ee6de6ff40223d (patch) | |
tree | dc13d87ccb395b03afaf10cd5a87755eea002ec3 /sys/kern/kern_event.c | |
parent | 06b00a671bcb44fa0375ea17871931d7e0b5c5ca (diff) | |
download | FreeBSD-src-e3b965f7d57557c7273b062793ee6de6ff40223d.zip FreeBSD-src-e3b965f7d57557c7273b062793ee6de6ff40223d.tar.gz |
remove holdfp()
Replace uses of holdfp() with fget*() or fgetvp*() calls as appropriate
introduce fget(), fget_read(), fget_write() - these functions will take
a thread and file descriptor and return a file pointer with its ref
count bumped.
introduce fgetvp(), fgetvp_read(), fgetvp_write() - these functions will
take a thread and file descriptor and return a vref()'d vnode.
*_read() requires that the file pointer be FREAD, *_write that it be
FWRITE.
This continues the cleanup of struct filedesc and struct file access
routines which, when are all through with it, will allow us to then
make the API calls MP safe and be able to move Giant down into the fo_*
functions.
Diffstat (limited to 'sys/kern/kern_event.c')
-rw-r--r-- | sys/kern/kern_event.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 191010d..5b4445c 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -394,23 +394,19 @@ struct kevent_args { int kevent(struct thread *td, struct kevent_args *uap) { - struct filedesc *fdp; struct kevent *kevp; struct kqueue *kq; - struct file *fp = NULL; + struct file *fp; struct timespec ts; int i, n, nerrors, error; mtx_lock(&Giant); - fdp = td->td_proc->p_fd; - if (((u_int)uap->fd) >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL || - (fp->f_type != DTYPE_KQUEUE)) { + if ((error = fget(td, uap->fd, &fp)) != 0) + goto done; + if (fp->f_type != DTYPE_KQUEUE) { error = EBADF; goto done; } - fhold(fp); - if (uap->timeout != NULL) { error = copyin(uap->timeout, &ts, sizeof(ts)); if (error) |