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 /sys/kern | |
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@
Diffstat (limited to 'sys/kern')
-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 |
10 files changed, 69 insertions, 68 deletions
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); } |