diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-09-23 16:51:15 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-09-23 16:51:15 +0000 |
commit | 6bb276a1685d8546283d224a3d249c66cc329264 (patch) | |
tree | 5e1c80d6cad38a8a82f5832e1e315103e7029eb9 /sys/arch/vax | |
parent | 96675671ec2520ade2f83b31563ab4da72bd443d (diff) |
Replace select backends with poll backends. selscan() and pollscan()
now call the poll backend. With this change we implement greater
poll(2) functionality instead of emulating it via the select backend.
Adapted from NetBSD and including some changes from FreeBSD.
Tested by many, deraadt@ OK
Diffstat (limited to 'sys/arch/vax')
-rw-r--r-- | sys/arch/vax/uba/qv.c | 45 | ||||
-rw-r--r-- | sys/arch/vax/vax/conf.c | 12 |
2 files changed, 28 insertions, 29 deletions
diff --git a/sys/arch/vax/uba/qv.c b/sys/arch/vax/uba/qv.c index 980be7646e9..e24a65bf29a 100644 --- a/sys/arch/vax/uba/qv.c +++ b/sys/arch/vax/uba/qv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qv.c,v 1.6 2003/06/02 23:27:58 millert Exp $ */ +/* $OpenBSD: qv.c,v 1.7 2003/09/23 16:51:11 millert Exp $ */ /* $NetBSD: qv.c,v 1.2 1996/09/02 06:44:28 mycroft Exp $ */ /*- @@ -142,6 +142,7 @@ #include "sys/uio.h" #include "sys/kernel.h" #include "sys/syslog.h" +#include "sys/poll.h" #include "../include/cpu.h" #include "../include/mtpr.h" #include "ubareg.h" @@ -494,33 +495,31 @@ qvwrite(dev, uio) /* - * Mouse activity select routine + * Mouse activity poll routine */ -qvselect(dev, rw) -dev_t dev; +int +qvpoll(dev, events, p) + dev_t dev; + int events; + struct proc *p; { - register int s = spl5(); - register struct qv_info *qp = qv_scn; + struct qv_info *qp = qv_scn; + int revents = 0; + int s = spl5(); - if( QVCHAN(minor(dev)) == QVMOUSECHAN ) - switch(rw) { - case FREAD: /* if events okay */ - if(qp->ihead != qp->itail) { - splx(s); - return(1); - } - qvrsel = u.u_procp; - splx(s); - return(0); - default: /* can never write */ - splx(s); - return(0); - } - else { + if (QVCHAN(minor(dev)) != QVMOUSECHAN) { splx(s); - return( ttselect(dev, rw) ); + return(ttpoll(dev, events, p)); + } + + if (events & (POLLIN | POLLRDNORM)) { + if (qp->ihead != qp->itail) + revents |= events & (POLLIN | POLLRDNORM); + else + qvrsel = u.u_procp; } - /*NOTREACHED*/ + splx(s); + return(revents); } /* diff --git a/sys/arch/vax/vax/conf.c b/sys/arch/vax/vax/conf.c index e3ba6533630..b1fbebb1460 100644 --- a/sys/arch/vax/vax/conf.c +++ b/sys/arch/vax/vax/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.41 2003/06/26 13:06:26 miod Exp $ */ +/* $OpenBSD: conf.c,v 1.42 2003/09/23 16:51:12 millert Exp $ */ /* $NetBSD: conf.c,v 1.44 1999/10/27 16:38:54 ragge Exp $ */ /*- @@ -199,17 +199,17 @@ struct consdev constab[]={ /* Special for console storage */ #define dev_type_rw(n) int n(dev_t, int, int, struct proc *) -/* plotters - open, close, write, ioctl, select*/ +/* plotters - open, close, write, ioctl, poll*/ #define cdev_plotter_init(c,n) { \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ - 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev } + 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev } /* console mass storage - open, close, read/write */ #define cdev_cnstore_init(c,n) { \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,write), (dev_type_ioctl((*))) enodev, \ - (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \ + (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \ (dev_type_mmap((*))) enodev } #define cdev_lp_init(c,n) { \ @@ -221,13 +221,13 @@ struct consdev constab[]={ #define cdev_graph_init(c,n) { \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \ - 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev } + 0, dev_init(c,n,poll), (dev_type_mmap((*))) enodev } /* Ingres */ #define cdev_ingres_init(c,n) { \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \ (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \ - (dev_type_stop((*))) nullop, 0, (dev_type_select((*))) nullop, \ + (dev_type_stop((*))) nullop, 0, (dev_type_poll((*))) nullop, \ (dev_type_mmap((*))) enodev } #define mmread mmrw |