From: millert Date: Fri, 1 May 2015 01:30:58 +0000 (+0000) Subject: Pass fflag to VOP_POLL so vfs fifo functions can get at the file X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4de3f78ca296b5b748d38aac267c73703f346679;p=openbsd Pass fflag to VOP_POLL so vfs fifo functions can get at the file flags to check FREAD/FWRITE if needed. This will be used by fifo_poll to avoid checking the write end of the fifo when the fd is read-only. OK guenther@ --- diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 2ad0003f890..577d7a34eed 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_tty.c,v 1.14 2015/03/14 03:38:51 jsg Exp $ */ +/* $OpenBSD: tty_tty.c,v 1.15 2015/05/01 01:30:58 millert Exp $ */ /* $NetBSD: tty_tty.c,v 1.13 1996/03/30 22:24:46 christos Exp $ */ /*- @@ -137,7 +137,7 @@ cttypoll(dev_t dev, int events, struct proc *p) if (ttyvp == NULL) /* try operation to get EOF/failure */ return (seltrue(dev, events, p)); - return (VOP_POLL(ttyvp, events, p)); + return (VOP_POLL(ttyvp, FREAD|FWRITE, events, p)); } /*ARGSUSED*/ diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index c874477ea1e..f9e21004445 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.81 2015/03/14 03:38:51 jsg Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.82 2015/05/01 01:30:58 millert Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -501,7 +501,7 @@ vn_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p) int vn_poll(struct file *fp, int events, struct proc *p) { - return (VOP_POLL(((struct vnode *)fp->f_data), events, p)); + return (VOP_POLL(((struct vnode *)fp->f_data), fp->f_flag, events, p)); } /* diff --git a/sys/kern/vfs_vops.c b/sys/kern/vfs_vops.c index 8d761f10f58..ad3c22b6736 100644 --- a/sys/kern/vfs_vops.c +++ b/sys/kern/vfs_vops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vops.c,v 1.12 2015/03/14 03:38:51 jsg Exp $ */ +/* $OpenBSD: vfs_vops.c,v 1.13 2015/05/01 01:30:58 millert Exp $ */ /* * Copyright (c) 2010 Thordur I. Bjornsson * @@ -260,10 +260,11 @@ VOP_IOCTL(struct vnode *vp, u_long command, void *data, int fflag, } int -VOP_POLL(struct vnode *vp, int events, struct proc *p) +VOP_POLL(struct vnode *vp, int fflag, int events, struct proc *p) { struct vop_poll_args a; a.a_vp = vp; + a.a_fflag = fflag; a.a_events = events; a.a_p = p; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 85727da1bc5..ca3ee2764f7 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode.h,v 1.130 2015/04/17 04:43:20 guenther Exp $ */ +/* $OpenBSD: vnode.h,v 1.131 2015/05/01 01:30:58 millert Exp $ */ /* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */ /* @@ -399,10 +399,11 @@ int VOP_IOCTL(struct vnode *, u_long, void *, int, struct ucred *, struct vop_poll_args { struct vnode *a_vp; + int a_fflag; int a_events; struct proc *a_p; }; -int VOP_POLL(struct vnode *, int, struct proc *); +int VOP_POLL(struct vnode *, int, int, struct proc *); struct vop_kqfilter_args { struct vnode *a_vp;