diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-08 13:53:29 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-08 13:53:29 +0000 |
commit | 0e31aec87e545a4e3f3d51781361eab6b72da8ad (patch) | |
tree | 3d1627b892c0d47f7ed56f61d4361e9c6fbb2266 /sys/kern/kern_event.c | |
parent | a25f400aa62632e991663528e26a5426c250d001 (diff) |
- Rename FILE_{,UN}USE to FREF and FRELE. USE is a bad verb and we don't have
the same semantics as NetBSD anyway, so it's good to avoid name collissions.
- Always fdremove before freeing the file, not the other way around.
- falloc FREFs the file.
- have FILE_SET_MATURE FRELE the file (It feels like a good ortogonality to
falloc FREFing the file).
- Use closef as much as possible instead of ffree in error paths of
falloc:ing functions. closef is much more careful with the fd and can
deal with the fd being forcibly closed by dup2. Also try to avoid
manually calling *fo_close when closef can do that for us (this makes
some error paths mroe complicated (sys_socketpair and sys_pipe), but
others become simpler (sys_open)).
Diffstat (limited to 'sys/kern/kern_event.c')
-rw-r--r-- | sys/kern/kern_event.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 04163b72d60..5256392ac48 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.15 2002/02/05 16:02:27 art Exp $ */ +/* $OpenBSD: kern_event.c,v 1.16 2002/02/08 13:53:28 art Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> @@ -339,7 +339,7 @@ sys_kevent(struct proc *p, void *v, register_t *retval) (fp->f_type != DTYPE_KQUEUE)) return (EBADF); - FILE_USE(fp); + FREF(fp); if (SCARG(uap, timeout) != NULL) { error = copyin(SCARG(uap, timeout), &ts, sizeof(ts)); @@ -390,7 +390,7 @@ sys_kevent(struct proc *p, void *v, register_t *retval) SCARG(uap, timeout), p, &n); *retval = n; done: - FILE_UNUSE(fp); + FRELE(fp); return (error); } @@ -422,7 +422,7 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p) /* validate descriptor */ if ((fp = fd_getfile(fdp, kev->ident)) == NULL) return (EBADF); - FILE_USE(fp); + FREF(fp); fp->f_count++; if (kev->ident < fdp->fd_knlistsize) { @@ -469,7 +469,7 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p) * apply reference count to knote structure, and * do not release it at the end of this routine. */ - FILE_UNUSE(fp); + FRELE(fp); fp = NULL; kn->kn_sfflags = kev->fflags; @@ -728,7 +728,7 @@ kqueue_close(struct file *fp, struct proc *p) while (kn != NULL) { kn0 = SLIST_NEXT(kn, kn_link); if (kq == kn->kn_kq) { - FILE_USE(kn->kn_fp); + FREF(kn->kn_fp); kn->kn_fop->f_detach(kn); closef(kn->kn_fp, p); knote_free(kn); @@ -871,7 +871,7 @@ knote_drop(struct knote *kn, struct proc *p) if (kn->kn_status & KN_QUEUED) knote_dequeue(kn); if (kn->kn_fop->f_isfd) { - FILE_USE(kn->kn_fp); + FREF(kn->kn_fp); closef(kn->kn_fp, p); } knote_free(kn); |