diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-04-22 05:43:15 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-04-22 05:43:15 +0000 |
commit | 2ca2111afa9d6ac1630b3e28226abd9d97b4e431 (patch) | |
tree | 32e68dee26390c4060d3b55fa2b8bded925f1c94 | |
parent | 856ac2591baaf667bfcf163c7fbcb9f5a766137e (diff) |
Add struct proc * argument to FRELE() and FILE_SET_MATURE() in
anticipation of further changes to closef(). No binary change.
ok krw@ miod@ deraadt@
-rw-r--r-- | sys/arch/i386/i386/linux_machdep.c | 4 | ||||
-rw-r--r-- | sys/compat/linux/linux_blkio.c | 4 | ||||
-rw-r--r-- | sys/compat/linux/linux_cdrom.c | 4 | ||||
-rw-r--r-- | sys/compat/linux/linux_fdio.c | 4 | ||||
-rw-r--r-- | sys/compat/linux/linux_file.c | 6 | ||||
-rw-r--r-- | sys/compat/linux/linux_hdio.c | 4 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.c | 6 | ||||
-rw-r--r-- | sys/compat/linux/linux_socket.c | 6 | ||||
-rw-r--r-- | sys/compat/linux/linux_termios.c | 4 | ||||
-rw-r--r-- | sys/compat/ossaudio/ossaudio.c | 8 | ||||
-rw-r--r-- | sys/crypto/cryptodev.c | 4 | ||||
-rw-r--r-- | sys/dev/diskmap.c | 6 | ||||
-rw-r--r-- | sys/dev/systrace.c | 4 | ||||
-rw-r--r-- | sys/kern/exec_script.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_descrip.c | 23 | ||||
-rw-r--r-- | sys/kern/kern_event.c | 10 | ||||
-rw-r--r-- | sys/kern/kern_exec.c | 4 | ||||
-rw-r--r-- | sys/kern/sys_generic.c | 12 | ||||
-rw-r--r-- | sys/kern/sys_pipe.c | 6 | ||||
-rw-r--r-- | sys/kern/tty_pty.c | 6 | ||||
-rw-r--r-- | sys/kern/uipc_socket.c | 8 | ||||
-rw-r--r-- | sys/kern/uipc_syscalls.c | 38 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 26 | ||||
-rw-r--r-- | sys/nfs/nfs_syscalls.c | 6 | ||||
-rw-r--r-- | sys/sys/file.h | 8 | ||||
-rw-r--r-- | sys/uvm/uvm_mmap.c | 8 |
26 files changed, 112 insertions, 111 deletions
diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c index 024e7c664b2..70f4c59ba52 100644 --- a/sys/arch/i386/i386/linux_machdep.c +++ b/sys/arch/i386/i386/linux_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_machdep.c,v 1.42 2011/11/07 15:41:33 guenther Exp $ */ +/* $OpenBSD: linux_machdep.c,v 1.43 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: linux_machdep.c,v 1.29 1996/05/03 19:42:11 christos Exp $ */ /* @@ -572,7 +572,7 @@ linux_machdepioctl(struct proc *p, void *v, register_t *retval) pt.com = SCARG(uap, com); pt.data = SCARG(uap, data); error = ioctlf(fp, PTIOCLINUX, (caddr_t)&pt, p); - FRELE(fp); + FRELE(fp, p); if (error == EJUSTRETURN) { retval[0] = (register_t)pt.data; error = 0; diff --git a/sys/compat/linux/linux_blkio.c b/sys/compat/linux/linux_blkio.c index 09f47187289..287ae3c7140 100644 --- a/sys/compat/linux/linux_blkio.c +++ b/sys/compat/linux/linux_blkio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_blkio.c,v 1.8 2010/05/18 04:41:14 dlg Exp $ */ +/* $OpenBSD: linux_blkio.c,v 1.9 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: linux_blkio.c,v 1.3 2001/01/18 17:48:04 tv Exp $ */ /* @@ -118,6 +118,6 @@ linux_ioctl_blkio(struct proc *p, struct linux_sys_ioctl_args *uap, error = ENOTTY; } - FRELE(fp); + FRELE(fp, p); return error; } diff --git a/sys/compat/linux/linux_cdrom.c b/sys/compat/linux/linux_cdrom.c index 49979d2640a..38385553335 100644 --- a/sys/compat/linux/linux_cdrom.c +++ b/sys/compat/linux/linux_cdrom.c @@ -1,5 +1,5 @@ -/* $OpenBSD: linux_cdrom.c,v 1.8 2002/03/14 01:26:50 millert Exp $ */ +/* $OpenBSD: linux_cdrom.c,v 1.9 2012/04/22 05:43:14 guenther Exp $ */ /* * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> * All rights reserved. @@ -293,6 +293,6 @@ linux_ioctl_cdrom(p, v, retval) error = sys_ioctl(p, &ia, retval); out: - FRELE(fp); + FRELE(fp, p); return (error); } diff --git a/sys/compat/linux/linux_fdio.c b/sys/compat/linux/linux_fdio.c index 46bd15290db..e84801153d4 100644 --- a/sys/compat/linux/linux_fdio.c +++ b/sys/compat/linux/linux_fdio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_fdio.c,v 1.6 2002/03/14 01:26:50 millert Exp $ */ +/* $OpenBSD: linux_fdio.c,v 1.7 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: linux_fdio.c,v 1.1 2000/12/10 14:12:16 fvdl Exp $ */ /* @@ -145,6 +145,6 @@ linux_ioctl_fdio(struct proc *p, struct linux_sys_ioctl_args *uap, error = EINVAL; } - FRELE(fp); + FRELE(fp, p); return 0; } diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 5c1a1bd2cec..e06c8b1bbfa 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_file.c,v 1.26 2011/11/25 10:10:05 robert Exp $ */ +/* $OpenBSD: linux_file.c,v 1.27 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: linux_file.c,v 1.15 1996/05/20 01:59:09 fvdl Exp $ */ /* @@ -200,7 +200,7 @@ linux_sys_open(p, v, retval) FREF(fp); if (fp->f_type == DTYPE_VNODE) (fp->f_ops->fo_ioctl) (fp, TIOCSCTTY, (caddr_t) 0, p); - FRELE(fp); + FRELE(fp, p); } return 0; } @@ -425,7 +425,7 @@ linux_sys_fcntl(p, v, retval) return EINVAL; FREF(fp); error = VOP_GETATTR(vp, &va, p->p_ucred, p); - FRELE(fp); + FRELE(fp, p); if (error) return error; d_tty = cdevsw[major(va.va_rdev)].d_tty; diff --git a/sys/compat/linux/linux_hdio.c b/sys/compat/linux/linux_hdio.c index ac96e740c10..3071eea93e0 100644 --- a/sys/compat/linux/linux_hdio.c +++ b/sys/compat/linux/linux_hdio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_hdio.c,v 1.7 2010/05/18 04:41:14 dlg Exp $ */ +/* $OpenBSD: linux_hdio.c,v 1.8 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: linux_hdio.c,v 1.1 2000/12/10 14:12:17 fvdl Exp $ */ /* @@ -179,6 +179,6 @@ linux_ioctl_hdio(struct proc *p, struct linux_sys_ioctl_args *uap, error = EINVAL; } - FRELE(fp); + FRELE(fp, p); return error; } diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 544bfe72cde..4977320ae6d 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_misc.c,v 1.75 2012/04/10 15:50:52 guenther Exp $ */ +/* $OpenBSD: linux_misc.c,v 1.76 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: linux_misc.c,v 1.27 1996/05/20 01:59:21 fvdl Exp $ */ /*- @@ -1023,7 +1023,7 @@ getdents_common(p, v, retval, is64bit) if (nbytes == 1) { /* emulating old, broken behaviour */ /* readdir(2) case. Always struct dirent. */ if (is64bit) { - FRELE(fp); + FRELE(fp, p); return (EINVAL); } nbytes = sizeof(struct linux_dirent); @@ -1043,7 +1043,7 @@ getdents_common(p, v, retval, is64bit) *retval = nbytes - args.resid; exit: - FRELE(fp); + FRELE(fp, p); return (error); } diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 21598960a36..d17d67811e0 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_socket.c,v 1.43 2011/12/03 12:38:30 fgsch Exp $ */ +/* $OpenBSD: linux_socket.c,v 1.44 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: linux_socket.c,v 1.14 1996/04/05 00:01:50 christos Exp $ */ /* @@ -1074,7 +1074,7 @@ linux_setsockopt(p, v, retval) } error = sosetopt(so, level, name, m); bad: - FRELE(fp); + FRELE(fp, p); return (error); } @@ -1588,6 +1588,6 @@ out: error = sys_ioctl(p, &ia, retval); } - FRELE(fp); + FRELE(fp, p); return (error); } diff --git a/sys/compat/linux/linux_termios.c b/sys/compat/linux/linux_termios.c index b65c1f956bb..cda6f1aeb51 100644 --- a/sys/compat/linux/linux_termios.c +++ b/sys/compat/linux/linux_termios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_termios.c,v 1.15 2003/04/05 20:30:18 millert Exp $ */ +/* $OpenBSD: linux_termios.c,v 1.16 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: linux_termios.c,v 1.3 1996/04/05 00:01:54 christos Exp $ */ /* @@ -720,6 +720,6 @@ linux_ioctl_termios(p, v, retval) error = sys_ioctl(p, &ia, retval); out: - FRELE(fp); + FRELE(fp, p); return (error); } diff --git a/sys/compat/ossaudio/ossaudio.c b/sys/compat/ossaudio/ossaudio.c index da12d6791e9..49581dcc41e 100644 --- a/sys/compat/ossaudio/ossaudio.c +++ b/sys/compat/ossaudio/ossaudio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ossaudio.c,v 1.13 2008/06/26 05:42:14 ray Exp $ */ +/* $OpenBSD: ossaudio.c,v 1.14 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: ossaudio.c,v 1.23 1997/10/19 07:41:52 augustss Exp $ */ /* @@ -88,7 +88,7 @@ oss_ioctl_audio(p, uap, retval) FREF(fp); if ((fp->f_flag & (FREAD | FWRITE)) == 0) { - FRELE(fp); + FRELE(fp, p); return (EBADF); } @@ -490,7 +490,7 @@ oss_ioctl_audio(p, uap, retval) break; } - FRELE(fp); + FRELE(fp, p); return (error); } @@ -805,7 +805,7 @@ oss_ioctl_mixer(p, uap, retval) error = copyout(&idat, SCARG(uap, data), sizeof idat); out: - FRELE(fp); + FRELE(fp, p); return (error); } diff --git a/sys/crypto/cryptodev.c b/sys/crypto/cryptodev.c index a6fd1be0ccb..2c4434bee15 100644 --- a/sys/crypto/cryptodev.c +++ b/sys/crypto/cryptodev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptodev.c,v 1.78 2012/02/15 04:26:27 guenther Exp $ */ +/* $OpenBSD: cryptodev.c,v 1.79 2012/04/22 05:43:14 guenther Exp $ */ /* * Copyright (c) 2001 Theo de Raadt @@ -679,7 +679,7 @@ cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) f->f_ops = &cryptofops; f->f_data = fcr; *(u_int32_t *)data = fd; - FILE_SET_MATURE(f); + FILE_SET_MATURE(f, p); break; default: error = EINVAL; diff --git a/sys/dev/diskmap.c b/sys/dev/diskmap.c index c2197d8abd7..8cd3182a342 100644 --- a/sys/dev/diskmap.c +++ b/sys/dev/diskmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diskmap.c,v 1.6 2011/07/07 23:45:00 matthew Exp $ */ +/* $OpenBSD: diskmap.c,v 1.7 2012/04/22 05:43:14 guenther Exp $ */ /* * Copyright (c) 2009, 2010 Joel Sing <jsing@openbsd.org> @@ -116,7 +116,7 @@ diskmapioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) VOP_UNLOCK(vp, 0, p); - FRELE(fp); + FRELE(fp, p); fdpunlock(fdp); free(devname, M_DEVBUF); @@ -126,7 +126,7 @@ bad: if (vp) vput(vp); if (fp) - FRELE(fp); + FRELE(fp, p); fdpunlock(fdp); diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c index 16d01c7d53d..3fc6d98c81c 100644 --- a/sys/dev/systrace.c +++ b/sys/dev/systrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: systrace.c,v 1.62 2012/02/20 22:23:39 guenther Exp $ */ +/* $OpenBSD: systrace.c,v 1.63 2012/04/22 05:43:14 guenther Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -539,7 +539,7 @@ systraceioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) f->f_ops = &systracefops; f->f_data = (caddr_t) fst; *(int *)data = fd; - FILE_SET_MATURE(f); + FILE_SET_MATURE(f, p); break; default: error = EINVAL; diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c index a6d730f8ece..a7e345b9699 100644 --- a/sys/kern/exec_script.c +++ b/sys/kern/exec_script.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_script.c,v 1.27 2012/02/15 04:26:27 guenther Exp $ */ +/* $OpenBSD: exec_script.c,v 1.28 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: exec_script.c,v 1.13 1996/02/04 02:15:06 christos Exp $ */ /* @@ -198,7 +198,7 @@ check_shell: fp->f_ops = &vnops; fp->f_data = (caddr_t) scriptvp; fp->f_flag = FREAD; - FILE_SET_MATURE(fp); + FILE_SET_MATURE(fp, p); } #endif diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index e6fd61c4fde..546503b49c1 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.92 2012/04/12 17:42:57 deraadt Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.93 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -219,7 +219,7 @@ restart: FREF(fp); fdplock(fdp); if ((error = fdalloc(p, 0, &new)) != 0) { - FRELE(fp); + FRELE(fp, p); if (error == ENOSPC) { fdexpand(p); fdpunlock(fdp); @@ -269,7 +269,7 @@ restart: fdplock(fdp); if (new >= fdp->fd_nfiles) { if ((error = fdalloc(p, new, &i)) != 0) { - FRELE(fp); + FRELE(fp, p); if (error == ENOSPC) { fdexpand(p); fdpunlock(fdp); @@ -325,7 +325,7 @@ restart: } fdplock(fdp); if ((error = fdalloc(p, newmin, &i)) != 0) { - FRELE(fp); + FRELE(fp, p); if (error == ENOSPC) { fdexpand(p); fdpunlock(fdp); @@ -513,7 +513,7 @@ restart: break; } out: - FRELE(fp); + FRELE(fp, p); return (error); } @@ -529,7 +529,7 @@ finishdup(struct proc *p, struct file *fp, int old, int new, fdpassertlocked(fdp); if (fp->f_count == LONG_MAX-2) { - FRELE(fp); + FRELE(fp, p); return (EDEADLK); } @@ -544,7 +544,7 @@ finishdup(struct proc *p, struct file *fp, int old, int new, fdp->fd_ofiles[new] = fp; fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] & ~UF_EXCLOSE; fp->f_count++; - FRELE(fp); + FRELE(fp, p); if (dup2 && oldfp == NULL) fd_used(fdp, new); *retval = new; @@ -634,7 +634,7 @@ sys_fstat(struct proc *p, void *v, register_t *retval) return (EBADF); FREF(fp); error = (*fp->f_ops->fo_stat)(fp, &ub, p); - FRELE(fp); + FRELE(fp, p); if (error == 0) { /* * Don't let non-root see generation numbers @@ -694,7 +694,7 @@ sys_fpathconf(struct proc *p, void *v, register_t *retval) error = EOPNOTSUPP; break; } - FRELE(fp); + FRELE(fp, p); return (error); } @@ -1089,6 +1089,7 @@ closef(struct file *fp, struct proc *p) * If the descriptor was in a message, POSIX-style locks * aren't passed with the descriptor. */ + if (p && ((fdp = p->p_fd) != NULL) && (fdp->fd_flags & FD_ADVLOCK) && fp->f_type == DTYPE_VNODE) { @@ -1103,7 +1104,7 @@ closef(struct file *fp, struct proc *p) } if (references_left) { - FRELE(fp); + FRELE(fp, p); return (0); } @@ -1176,7 +1177,7 @@ sys_flock(struct proc *p, void *v, register_t *retval) else error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, F_FLOCK|F_WAIT); out: - FRELE(fp); + FRELE(fp, p); return (error); } diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 0dba7f3412b..b016310e652 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.45 2012/03/25 20:33:54 deraadt Exp $ */ +/* $OpenBSD: kern_event.c,v 1.46 2012/04/22 05:43:14 guenther Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> @@ -457,7 +457,7 @@ sys_kqueue(struct proc *p, void *v, register_t *retval) if (fdp->fd_knlistsize < 0) fdp->fd_knlistsize = 0; /* this process has a kq */ kq->kq_fdp = fdp; - FILE_SET_MATURE(fp); + FILE_SET_MATURE(fp, p); return (0); } @@ -535,7 +535,7 @@ sys_kevent(struct proc *p, void *v, register_t *retval) } KQREF(kq); - FRELE(fp); + FRELE(fp, p); error = kqueue_scan(kq, SCARG(uap, nevents), SCARG(uap, eventlist), SCARG(uap, timeout), p, &n); KQRELE(kq); @@ -543,7 +543,7 @@ sys_kevent(struct proc *p, void *v, register_t *retval) return (error); done: - FRELE(fp); + FRELE(fp, p); return (error); } @@ -623,7 +623,7 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p) * do not release it at the end of this routine. */ if (fp != NULL) - FRELE(fp); + FRELE(fp, p); fp = NULL; kn->kn_sfflags = kev->fflags; diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index ebaca46f136..4af5428542f 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.129 2012/04/13 16:37:50 kettenis Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.130 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -586,7 +586,7 @@ sys_execve(struct proc *p, void *v, register_t *retval) fp->f_type = DTYPE_VNODE; fp->f_ops = &vnops; fp->f_data = (caddr_t)vp; - FILE_SET_MATURE(fp); + FILE_SET_MATURE(fp, p); } } fdpunlock(p->p_fd); diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 1c20b4b93f9..60e69e6ba22 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_generic.c,v 1.75 2012/03/19 09:05:39 guenther Exp $ */ +/* $OpenBSD: sys_generic.c,v 1.76 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */ /* @@ -217,7 +217,7 @@ dofilereadv(struct proc *p, int fd, struct file *fp, const struct iovec *iovp, if (needfree) free(needfree, M_IOV); out: - FRELE(fp); + FRELE(fp, p); return (error); } @@ -373,7 +373,7 @@ dofilewritev(struct proc *p, int fd, struct file *fp, const struct iovec *iovp, if (needfree) free(needfree, M_IOV); out: - FRELE(fp); + FRELE(fp, p); return (error); } @@ -513,7 +513,7 @@ sys_ioctl(struct proc *p, void *v, register_t *retval) if (error == 0 && (com&IOC_OUT) && size) error = copyout(data, SCARG(uap, data), (u_int)size); out: - FRELE(fp); + FRELE(fp, p); if (memp) free(memp, M_IOCTLOPS); return (error); @@ -672,7 +672,7 @@ selscan(struct proc *p, fd_set *ibits, fd_set *obits, int nfd, int ni, FD_SET(fd, pobits); n++; } - FRELE(fp); + FRELE(fp, p); } } } @@ -767,7 +767,7 @@ pollscan(struct proc *p, struct pollfd *pl, u_int nfd, register_t *retval) } FREF(fp); pl->revents = (*fp->f_ops->fo_poll)(fp, pl->events, p); - FRELE(fp); + FRELE(fp, p); if (pl->revents != 0) n++; } diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index a3edd7cf7cf..5e0058013c0 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.61 2011/07/08 19:00:09 tedu Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.62 2012/04/22 05:43:14 guenther Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -141,8 +141,8 @@ sys_pipe(struct proc *p, void *v, register_t *retval) rpipe->pipe_peer = wpipe; wpipe->pipe_peer = rpipe; - FILE_SET_MATURE(rf); - FILE_SET_MATURE(wf); + FILE_SET_MATURE(rf, p); + FILE_SET_MATURE(wf, p); error = copyout(fds, SCARG(uap, fdp), sizeof(fds)); if (error != 0) { diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index b60e63273b5..4ef264ff9f0 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_pty.c,v 1.57 2011/07/05 04:48:02 guenther Exp $ */ +/* $OpenBSD: tty_pty.c,v 1.58 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */ /* @@ -1190,8 +1190,8 @@ retry: memcpy(ptm->sn, pti->pty_sn, sizeof(pti->pty_sn)); /* mark the files mature now that we've passed all errors */ - FILE_SET_MATURE(cfp); - FILE_SET_MATURE(sfp); + FILE_SET_MATURE(cfp, p); + FILE_SET_MATURE(sfp, p); fdpunlock(fdp); break; diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 6749f4c56c5..255cf6c8680 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.98 2012/03/23 15:51:26 guenther Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.99 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -1058,12 +1058,12 @@ sosplice(struct socket *so, int fd, off_t max, struct timeval *tv) /* Lock both receive and send buffer. */ if ((error = sblock(&so->so_rcv, (so->so_state & SS_NBIO) ? M_NOWAIT : M_WAITOK)) != 0) { - FRELE(fp); + FRELE(fp, curproc); return (error); } if ((error = sblock(&sosp->so_snd, M_WAITOK)) != 0) { sbunlock(&so->so_rcv); - FRELE(fp); + FRELE(fp, curproc); return (error); } s = splsoftnet(); @@ -1109,7 +1109,7 @@ sosplice(struct socket *so, int fd, off_t max, struct timeval *tv) splx(s); sbunlock(&sosp->so_snd); sbunlock(&so->so_rcv); - FRELE(fp); + FRELE(fp, curproc); return (error); } diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index ebd25d673a4..297bb96572d 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.84 2011/12/03 12:38:30 fgsch Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.85 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -92,7 +92,7 @@ sys_socket(struct proc *p, void *v, register_t *retval) fdpunlock(fdp); } else { fp->f_data = so; - FILE_SET_MATURE(fp); + FILE_SET_MATURE(fp, p); *retval = fd; } out: @@ -124,7 +124,7 @@ sys_bind(struct proc *p, void *v, register_t *retval) error = sobind(fp->f_data, nam, p); m_freem(nam); } - FRELE(fp); + FRELE(fp, p); return (error); } @@ -142,7 +142,7 @@ sys_listen(struct proc *p, void *v, register_t *retval) if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); error = solisten(fp->f_data, SCARG(uap, backlog)); - FRELE(fp); + FRELE(fp, p); return (error); } @@ -256,13 +256,13 @@ sys_accept(struct proc *p, void *v, register_t *retval) closef(fp, p); fdpunlock(p->p_fd); } else { - FILE_SET_MATURE(fp); + FILE_SET_MATURE(fp, p); *retval = tmpfd; } m_freem(nam); bad: splx(s); - FRELE(headfp); + FRELE(headfp, p); return (error); } @@ -284,7 +284,7 @@ sys_connect(struct proc *p, void *v, register_t *retval) return (error); so = fp->f_data; if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) { - FRELE(fp); + FRELE(fp, p); return (EALREADY); } error = sockargs(&nam, SCARG(uap, name), SCARG(uap, namelen), @@ -299,7 +299,7 @@ sys_connect(struct proc *p, void *v, register_t *retval) if (error) goto bad; if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) { - FRELE(fp); + FRELE(fp, p); m_freem(nam); return (EINPROGRESS); } @@ -317,7 +317,7 @@ sys_connect(struct proc *p, void *v, register_t *retval) splx(s); bad: so->so_state &= ~SS_ISCONNECTING; - FRELE(fp); + FRELE(fp, p); if (nam) m_freem(nam); if (error == ERESTART) @@ -374,8 +374,8 @@ sys_socketpair(struct proc *p, void *v, register_t *retval) } error = copyout(sv, SCARG(uap, rsv), 2 * sizeof (int)); if (error == 0) { - FILE_SET_MATURE(fp1); - FILE_SET_MATURE(fp2); + FILE_SET_MATURE(fp1, p); + FILE_SET_MATURE(fp2, p); fdpunlock(fdp); return (0); } @@ -542,7 +542,7 @@ sendit(struct proc *p, int s, struct msghdr *mp, int flags, register_t *retsize) } #endif bad: - FRELE(fp); + FRELE(fp, p); if (to) m_freem(to); return (error); @@ -739,7 +739,7 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp, fp->f_rbytes += *retsize; } out: - FRELE(fp); + FRELE(fp, p); if (from) m_freem(from); if (control) @@ -761,7 +761,7 @@ sys_shutdown(struct proc *p, void *v, register_t *retval) if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); error = soshutdown(fp->f_data, SCARG(uap, how)); - FRELE(fp); + FRELE(fp, p); return (error); } @@ -812,7 +812,7 @@ sys_setsockopt(struct proc *p, void *v, register_t *retval) bad: if (m) m_freem(m); - FRELE(fp); + FRELE(fp, p); return (error); } @@ -852,7 +852,7 @@ sys_getsockopt(struct proc *p, void *v, register_t *retval) SCARG(uap, avalsize), sizeof (valsize)); } out: - FRELE(fp); + FRELE(fp, p); if (m != NULL) (void)m_free(m); return (error); @@ -897,7 +897,7 @@ sys_getsockname(struct proc *p, void *v, register_t *retval) error = copyout(&len, SCARG(uap, alen), sizeof (len)); } bad: - FRELE(fp); + FRELE(fp, p); if (m) m_freem(m); return (error); @@ -925,7 +925,7 @@ sys_getpeername(struct proc *p, void *v, register_t *retval) return (error); so = fp->f_data; if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) { - FRELE(fp); + FRELE(fp, p); return (ENOTCONN); } error = copyin(SCARG(uap, alen), &len, sizeof (len)); @@ -946,7 +946,7 @@ sys_getpeername(struct proc *p, void *v, register_t *retval) error = copyout(&len, SCARG(uap, alen), sizeof (len)); } bad: - FRELE(fp); + FRELE(fp, p); m_freem(m); return (error); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index ef16e737321..edc88b4b69e 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.181 2012/03/19 09:05:39 guenther Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.182 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -607,12 +607,12 @@ sys_fstatfs(struct proc *p, void *v, register_t *retval) return (error); mp = ((struct vnode *)fp->f_data)->v_mount; if (!mp) { - FRELE(fp); + FRELE(fp, p); return (ENOENT); } sp = &mp->mnt_stat; error = VFS_STATFS(mp, sp, p); - FRELE(fp); + FRELE(fp, p); if (error) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; @@ -935,7 +935,7 @@ doopenat(struct proc *p, int fd, const char *path, int oflags, mode_t mode, if (flags & O_CLOEXEC) fdp->fd_ofileflags[indx] |= UF_EXCLOSE; *retval = indx; - FILE_SET_MATURE(fp); + FILE_SET_MATURE(fp, p); out: fdpunlock(fdp); return (error); @@ -1091,7 +1091,7 @@ sys_fhopen(struct proc *p, void *v, register_t *retval) } VOP_UNLOCK(vp, 0, p); *retval = indx; - FILE_SET_MATURE(fp); + FILE_SET_MATURE(fp, p); fdpunlock(fdp); return (0); @@ -1599,7 +1599,7 @@ sys_lseek(struct proc *p, void *v, register_t *retval) fp->f_seek++; error = 0; bad: - FRELE(fp); + FRELE(fp, p); return (error); } @@ -1928,7 +1928,7 @@ sys_fchflags(struct proc *p, void *v, register_t *retval) } out: VOP_UNLOCK(vp, 0, p); - FRELE(fp); + FRELE(fp, p); return (error); } @@ -2024,7 +2024,7 @@ sys_fchmod(struct proc *p, void *v, register_t *retval) error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); } VOP_UNLOCK(vp, 0, p); - FRELE(fp); + FRELE(fp, p); return (error); } @@ -2199,7 +2199,7 @@ sys_fchown(struct proc *p, void *v, register_t *retval) } out: VOP_UNLOCK(vp, 0, p); - FRELE(fp); + FRELE(fp, p); return (error); } @@ -2397,7 +2397,7 @@ dofutimens(struct proc *p, int fd, struct timespec ts[2], register_t *retval) return (error); vp = (struct vnode *)fp->f_data; vref(vp); - FRELE(fp); + FRELE(fp, p); return (dovutimens(p, vp, ts, retval)); } @@ -2472,7 +2472,7 @@ sys_ftruncate(struct proc *p, void *v, register_t *retval) } VOP_UNLOCK(vp, 0, p); bad: - FRELE(fp); + FRELE(fp, p); return (error); } @@ -2501,7 +2501,7 @@ sys_fsync(struct proc *p, void *v, register_t *retval) #endif VOP_UNLOCK(vp, 0, p); - FRELE(fp); + FRELE(fp, p); return (error); } @@ -2737,7 +2737,7 @@ getdirentries_internal(struct proc *p, int fd, char *buf, int count, goto bad; *retval = count - auio.uio_resid; bad: - FRELE(fp); + FRELE(fp, p); return (error); } diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index 03edee3e145..12d70634aa8 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.92 2010/12/05 12:18:00 kettenis Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.93 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -180,12 +180,12 @@ sys_nfssvc(struct proc *p, void *v, register_t *retval) error = sockargs(&nam, nfsdarg.name, nfsdarg.namelen, MT_SONAME); if (error) { - FRELE(fp); + FRELE(fp, p); return (error); } } error = nfssvc_addsock(fp, nam); - FRELE(fp); + FRELE(fp, p); break; case NFSSVC_NFSD: error = copyin(SCARG(uap, argp), nsd, sizeof(*nsd)); diff --git a/sys/sys/file.h b/sys/sys/file.h index 30ecebe7628..c36470bd21e 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -1,4 +1,4 @@ -/* $OpenBSD: file.h,v 1.28 2011/06/28 10:15:38 thib Exp $ */ +/* $OpenBSD: file.h,v 1.29 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: file.h,v 1.11 1995/03/26 20:24:13 jtc Exp $ */ /* @@ -95,15 +95,15 @@ struct file { (((fp)->f_iflags & (FIF_WANTCLOSE|FIF_LARVAL)) == 0) #define FREF(fp) do { (fp)->f_usecount++; } while (0) -#define FRELE(fp) do { \ +#define FRELE(fp,p) do { \ --(fp)->f_usecount; \ if (((fp)->f_iflags & FIF_WANTCLOSE) != 0) \ wakeup(&(fp)->f_usecount); \ } while (0) -#define FILE_SET_MATURE(fp) do { \ +#define FILE_SET_MATURE(fp,p) do { \ (fp)->f_iflags &= ~FIF_LARVAL; \ - FRELE(fp); \ + FRELE(fp, p); \ } while (0) LIST_HEAD(filelist, file); diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c index 383e25a092b..da9a291c877 100644 --- a/sys/uvm/uvm_mmap.c +++ b/sys/uvm/uvm_mmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_mmap.c,v 1.89 2012/04/10 10:30:44 ariane Exp $ */ +/* $OpenBSD: uvm_mmap.c,v 1.90 2012/04/22 05:43:14 guenther Exp $ */ /* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */ /* @@ -154,7 +154,7 @@ sys_mquery(struct proc *p, void *v, register_t *retval) *retval = (register_t)(vaddr); if (fp != NULL) - FRELE(fp); + FRELE(fp, p); return (error); } @@ -421,7 +421,7 @@ sys_mmap(struct proc *p, void *v, register_t *retval) /* special case: catch SunOS style /dev/zero */ if (vp->v_type == VCHR && iszerodev(vp->v_rdev)) { flags |= MAP_ANON; - FRELE(fp); + FRELE(fp, p); fp = NULL; goto is_anon; } @@ -538,7 +538,7 @@ sys_mmap(struct proc *p, void *v, register_t *retval) out: if (fp) - FRELE(fp); + FRELE(fp, p); return (error); } |