diff options
author | peter <peter@FreeBSD.org> | 1997-09-14 03:19:42 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1997-09-14 03:19:42 +0000 |
commit | 796eb5ce0afbb92f7c829367cc09ec04472e0166 (patch) | |
tree | 0720cfdb6d407dea01c6b7bc049ac3afa3cc5020 | |
parent | e762286917ce1de5d1fc3744a413be43a74c656b (diff) | |
download | FreeBSD-src-796eb5ce0afbb92f7c829367cc09ec04472e0166.zip FreeBSD-src-796eb5ce0afbb92f7c829367cc09ec04472e0166.tar.gz |
Update select -> poll in drivers.
45 files changed, 260 insertions, 257 deletions
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index 5ca3293..d6bcef4 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.45 1997/06/02 08:19:03 dfr Exp $ + * $Id: mem.c,v 1.46 1997/07/20 08:37:20 bde Exp $ */ /* @@ -79,13 +79,13 @@ static d_close_t mmclose; static d_read_t mmrw; static d_ioctl_t mmioctl; static d_mmap_t memmmap; -static d_select_t mmselect; +static d_poll_t mmpoll; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { mmopen, mmclose, mmrw, mmrw, /*2*/ mmioctl, nullstop, nullreset, nodevtotty,/* memory */ - mmselect, memmmap, NULL, "mem", NULL, -1 }; + mmpoll, memmmap, NULL, "mem", NULL, -1 }; static caddr_t zbuf; @@ -481,17 +481,17 @@ mmioctl(dev, cmd, cmdarg, flags, p) } int -mmselect(dev, rw, p) +mmpoll(dev, events, p) dev_t dev; - int rw; + int events; struct proc *p; { switch (minor(dev)) { case 3: /* /dev/random */ - return random_select(dev, rw, p); + return random_poll(dev, events, p); case 4: /* /dev/urandom */ default: - return seltrue(dev, rw, p); + return seltrue(dev, events, p); } } diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 40f0bf3..b56fc42 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.52 1997/09/01 07:45:25 fsmp Exp $ + * $Id: cy.c,v 1.53 1997/09/03 01:50:24 bde Exp $ */ #include "cy.h" @@ -381,7 +381,7 @@ static d_devtotty_t siodevtotty; static struct cdevsw sio_cdevsw = { sioopen, sioclose, sioread, siowrite, sioioctl, siostop, noreset, siodevtotty, - ttselect, nommap, NULL, driver_name, + ttpoll, nommap, NULL, driver_name, NULL, -1, }; diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index 40f0bf3..b56fc42 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.52 1997/09/01 07:45:25 fsmp Exp $ + * $Id: cy.c,v 1.53 1997/09/03 01:50:24 bde Exp $ */ #include "cy.h" @@ -381,7 +381,7 @@ static d_devtotty_t siodevtotty; static struct cdevsw sio_cdevsw = { sioopen, sioclose, sioread, siowrite, sioioctl, siostop, noreset, siodevtotty, - ttselect, nommap, NULL, driver_name, + ttpoll, nommap, NULL, driver_name, NULL, -1, }; diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c index e0b1808..a146720 100644 --- a/sys/dev/dgb/dgb.c +++ b/sys/dev/dgb/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.26 1997/06/14 15:19:48 bde Exp $ + * dgb.c $Id: dgb.c,v 1.27 1997/07/01 00:22:35 bde Exp $ * * Digiboard driver. * @@ -227,7 +227,7 @@ static d_devtotty_t dgbdevtotty; static struct cdevsw dgb_cdevsw = { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/ dgbioctl, dgbstop, noreset, dgbdevtotty, /* dgb */ - ttselect, nommap, NULL, "dgb", NULL, -1 }; + ttpoll, nommap, NULL, "dgb", NULL, -1 }; static speed_t dgbdefaultrate = TTYDEF_SPEED; diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index 091ff8c..8be260c 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -11,7 +11,7 @@ * this software for any purpose. It is provided "as is" * without express or implied warranty. * - * $Id: mse.c,v 1.32 1997/03/24 11:23:56 bde Exp $ + * $Id: mse.c,v 1.33 1997/07/20 14:10:06 bde Exp $ */ /* * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and @@ -51,6 +51,7 @@ #include <sys/conf.h> #include <sys/proc.h> #include <sys/kernel.h> +#include <sys/poll.h> #include <sys/uio.h> #ifdef DEVFS #include <sys/devfsext.h> @@ -70,13 +71,13 @@ struct isa_driver msedriver = { static d_open_t mseopen; static d_close_t mseclose; static d_read_t mseread; -static d_select_t mseselect; +static d_poll_t msepoll; #define CDEV_MAJOR 27 static struct cdevsw mse_cdevsw = { mseopen, mseclose, mseread, nowrite, /*27*/ noioc, nostop, nullreset, nodevtotty,/* mse */ - mseselect, nommap, NULL, "mse", NULL, -1 }; + msepoll, nommap, NULL, "mse", NULL, -1 }; /* @@ -365,31 +366,34 @@ mseread(dev, uio, ioflag) } /* - * mseselect: check for mouse input to be processed. + * msepoll: check for mouse input to be processed. */ static int -mseselect(dev, rw, p) +msepoll(dev, events, p) dev_t dev; - int rw; + int events; struct proc *p; { register struct mse_softc *sc = &mse_sc[MSE_UNIT(dev)]; int s; + int revents = 0; s = spltty(); - if (sc->sc_bytesread != PROTOBYTES || sc->sc_deltax != 0 || - sc->sc_deltay != 0 || (sc->sc_obuttons ^ sc->sc_buttons) != 0) { - splx(s); - return (1); - } + if (events & (POLLIN | POLLRDNORM)) + if (sc->sc_bytesread != PROTOBYTES || sc->sc_deltax != 0 || + sc->sc_deltay != 0 || + (sc->sc_obuttons ^ sc->sc_buttons) != 0) + revents |= events & (POLLIN | POLLRDNORM); + else { + /* + * Since this is an exclusive open device, any previous + * proc pointer is trash now, so we can just assign it. + */ + selrecord(p, &sc->sc_selp); + } - /* - * Since this is an exclusive open device, any previous proc. - * pointer is trash now, so we can just assign it. - */ - selrecord(p, &sc->sc_selp); splx(s); - return (0); + return (revents); } /* diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index bb5a0f8..468ec05 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pci.c,v 1.77 1997/06/25 20:56:29 fsmp Exp $ + * $Id: pci.c,v 1.78 1997/08/02 14:33:12 bde Exp $ * */ @@ -569,7 +569,7 @@ static unsigned pci_dev_list_size; static struct cdevsw pcicdev = { pci_open, pci_close, noread, nowrite, pci_ioctl, nostop, noreset, - nodevtotty, noselect, nommap, nostrategy, "pci", 0, PCI_CDEV + nodevtotty, seltrue, nommap, nostrategy, "pci", 0, PCI_CDEV }; #ifdef DEVFS diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 8a721e0..541e3f5 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -107,7 +107,7 @@ static d_devtotty_t rcdevtotty; static struct cdevsw rc_cdevsw = { rcopen, rcclose, rcread, rcwrite, /*63*/ rcioctl, rcstop, noreset, rcdevtotty,/* rc */ - ttselect, nommap, NULL, "rc", NULL, -1 }; + ttpoll, nommap, NULL, "rc", NULL, -1 }; /* Per-board structure */ static struct rc_softc { diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index 8b0ef3e..0403e89 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -801,7 +801,7 @@ static d_devtotty_t rpdevtotty; static struct cdevsw rp_cdevsw = { rpopen, rpclose, rpread, rpwrite, rpioctl, rpstop, noreset, rpdevtotty, - ttselect, nommap, NULL, driver_name, + ttpoll, nommap, NULL, driver_name, NULL, -1}; static int rp_controller_port = 0; diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index 86b9de4..bd756a3 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.58 1997/04/20 15:36:04 bde Exp $ + * $Id: si.c,v 1.59 1997/07/20 14:10:11 bde Exp $ */ #ifndef lint @@ -122,7 +122,7 @@ static d_devtotty_t sidevtotty; static struct cdevsw si_cdevsw = { siopen, siclose, siread, siwrite, /*68*/ siioctl, sistop, noreset, sidevtotty,/* si */ - ttselect, nommap, NULL, "si", NULL, -1 }; + ttpoll, nommap, NULL, "si", NULL, -1 }; #ifdef SI_DEBUG /* use: ``options "SI_DEBUG"'' in your config file */ diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 5cf4f65..d7bebbb 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.11 1997/09/01 07:37:01 smp Exp smp $ + * $Id: sio.c,v 1.180 1997/09/01 07:45:28 fsmp Exp $ */ #include "opt_comconsole.h" @@ -348,7 +348,7 @@ static d_devtotty_t siodevtotty; static struct cdevsw sio_cdevsw = { sioopen, sioclose, sioread, siowrite, sioioctl, siostop, noreset, siodevtotty, - ttselect, nommap, NULL, driver_name, + ttpoll, nommap, NULL, driver_name, NULL, -1, }; diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 25bf831..d9fe634 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.230 1997/08/09 19:24:03 sos Exp $ + * $Id: syscons.c,v 1.231 1997/09/04 23:01:03 yokota Exp $ */ #include "sc.h" @@ -250,7 +250,7 @@ static d_mmap_t scmmap; static struct cdevsw scdevsw = { scopen, scclose, scread, scwrite, scioctl, nullstop, noreset, scdevtotty, - ttselect, scmmap, nostrategy, "sc", NULL, -1 }; + ttpoll, scmmap, nostrategy, "sc", NULL, -1 }; /* * These functions need to be before calls to them so they can be inlined. diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c index e0b1808..a146720 100644 --- a/sys/gnu/i386/isa/dgb.c +++ b/sys/gnu/i386/isa/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.26 1997/06/14 15:19:48 bde Exp $ + * dgb.c $Id: dgb.c,v 1.27 1997/07/01 00:22:35 bde Exp $ * * Digiboard driver. * @@ -227,7 +227,7 @@ static d_devtotty_t dgbdevtotty; static struct cdevsw dgb_cdevsw = { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/ dgbioctl, dgbstop, noreset, dgbdevtotty, /* dgb */ - ttselect, nommap, NULL, "dgb", NULL, -1 }; + ttpoll, nommap, NULL, "dgb", NULL, -1 }; static speed_t dgbdefaultrate = TTYDEF_SPEED; diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c index 0f8c57d..1da0188 100644 --- a/sys/i386/i386/cons.c +++ b/sys/i386/i386/cons.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.53 1997/08/08 20:09:50 julian Exp $ + * $Id: cons.c,v 1.54 1997/08/08 20:29:47 julian Exp $ */ #include <sys/param.h> @@ -76,13 +76,13 @@ static d_close_t cnclose; static d_read_t cnread; static d_write_t cnwrite; static d_ioctl_t cnioctl; -static d_select_t cnselect; +static d_poll_t cnpoll; #define CDEV_MAJOR 0 static struct cdevsw cn_cdevsw = { cnopen, cnclose, cnread, cnwrite, /*0*/ cnioctl, nullstop, nullreset, nodevtotty,/* console */ - cnselect, nommap, NULL, "console", NULL, -1 }; + cnpoll, nommap, NULL, "console", NULL, -1 }; static dev_t cn_dev_t; /* seems to be never really used */ SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD, @@ -374,9 +374,9 @@ cnioctl(dev, cmd, data, flag, p) } static int -cnselect(dev, rw, p) +cnpoll(dev, events, p) dev_t dev; - int rw; + int events; struct proc *p; { if ((cn_tab == NULL) || cn_mute) @@ -384,7 +384,7 @@ cnselect(dev, rw, p) dev = cn_tab->cn_dev; - return ((*cdevsw[major(dev)]->d_select)(dev, rw, p)); + return ((*cdevsw[major(dev)]->d_poll)(dev, events, p)); } int diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 5ca3293..d6bcef4 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.45 1997/06/02 08:19:03 dfr Exp $ + * $Id: mem.c,v 1.46 1997/07/20 08:37:20 bde Exp $ */ /* @@ -79,13 +79,13 @@ static d_close_t mmclose; static d_read_t mmrw; static d_ioctl_t mmioctl; static d_mmap_t memmmap; -static d_select_t mmselect; +static d_poll_t mmpoll; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { mmopen, mmclose, mmrw, mmrw, /*2*/ mmioctl, nullstop, nullreset, nodevtotty,/* memory */ - mmselect, memmmap, NULL, "mem", NULL, -1 }; + mmpoll, memmmap, NULL, "mem", NULL, -1 }; static caddr_t zbuf; @@ -481,17 +481,17 @@ mmioctl(dev, cmd, cmdarg, flags, p) } int -mmselect(dev, rw, p) +mmpoll(dev, events, p) dev_t dev; - int rw; + int events; struct proc *p; { switch (minor(dev)) { case 3: /* /dev/random */ - return random_select(dev, rw, p); + return random_poll(dev, events, p); case 4: /* /dev/urandom */ default: - return seltrue(dev, rw, p); + return seltrue(dev, events, p); } } diff --git a/sys/i386/include/random.h b/sys/i386/include/random.h index 659fdf9..b2b7d12 100644 --- a/sys/i386/include/random.h +++ b/sys/i386/include/random.h @@ -1,7 +1,7 @@ /* * random.h -- A strong random number generator * - * $Id: random.h,v 1.11 1997/02/22 09:35:05 peter Exp $ + * $Id: random.h,v 1.12 1997/06/07 00:57:26 bde Exp $ * * Version 0.95, last modified 18-Oct-95 * @@ -80,7 +80,7 @@ u_int read_random_unlimited(char *buf, u_int size); #ifdef notused u_int write_random(const char *buf, u_int nbytes); #endif -int random_select(dev_t dev, int rw, struct proc *p); +int random_poll(dev_t dev, int events, struct proc *p); #endif /* KERNEL */ diff --git a/sys/i386/isa/asc.c b/sys/i386/isa/asc.c index 61f3415..41b6c27 100644 --- a/sys/i386/isa/asc.c +++ b/sys/i386/isa/asc.c @@ -34,7 +34,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * $Id: asc.c,v 1.25 1997/03/24 11:23:39 bde Exp $ + * $Id: asc.c,v 1.26 1997/04/14 16:47:38 jkh Exp $ */ #include "asc.h" @@ -60,6 +60,7 @@ #include <sys/buf.h> #include <sys/malloc.h> #include <sys/kernel.h> +#include <sys/poll.h> #ifdef DEVFS #include <sys/devfsext.h> #endif /*DEVFS*/ @@ -209,14 +210,14 @@ static d_open_t ascopen; static d_close_t ascclose; static d_read_t ascread; static d_ioctl_t ascioctl; -static d_select_t ascselect; +static d_poll_t ascpoll; #define CDEV_MAJOR 71 static struct cdevsw asc_cdevsw = { ascopen, ascclose, ascread, nowrite, /*71*/ ascioctl, nostop, nullreset, nodevtotty, /* asc */ - ascselect, nommap, NULL, "asc", NULL, -1 }; + ascpoll, nommap, NULL, "asc", NULL, -1 }; #define STATIC static #else @@ -891,32 +892,30 @@ ascioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p) } STATIC int -ascselect(dev_t dev, int rw, struct proc *p) +ascpoll(dev_t dev, int events, struct proc *p) { int unit = UNIT(minor(dev)); struct asc_unit *scu = unittab + unit; - int sps=spltty(); + int sps; struct proc *p1; + int revents = 0; + + sps=spltty(); + + if (events & (POLLIN | POLLRDNORM)) + if (scu->sbuf.count >0) + revents |= events & (POLLIN | POLLRDNORM); + else { + if (!(scu->flags & DMA_ACTIVE)) + dma_restart(scu); + + if (scu->selp.si_pid && (p1=pfind(scu->selp.si_pid)) + && p1->p_wchan == (caddr_t)&selwait) + scu->selp.si_flags = SI_COLL; + else + scu->selp.si_pid = p->p_pid; + } - if (scu->sbuf.count >0) { - splx(sps); - return 1; - } - if (!(scu->flags & DMA_ACTIVE)) dma_restart(scu); -#ifdef FREEBSD_1_X - if (scu->selp== (pid_t)0) { - scu->selp= p->p_pid; - } else { - scu->flags |= SEL_COLL; - } -#else - - if (scu->selp.si_pid && (p1=pfind(scu->selp.si_pid)) - && p1->p_wchan == (caddr_t)&selwait) - scu->selp.si_flags = SI_COLL; - else - scu->selp.si_pid = p->p_pid; -#endif splx(sps); return 0; } diff --git a/sys/i386/isa/b004.c b/sys/i386/isa/b004.c index 1deaee9..9569126 100644 --- a/sys/i386/isa/b004.c +++ b/sys/i386/isa/b004.c @@ -112,13 +112,13 @@ static d_close_t bquclose; static d_read_t bquread; static d_write_t bquwrite; static d_ioctl_t bquioctl; -static d_select_t bquselect; +static d_poll_t bqupoll; #define CDEV_MAJOR 8 static struct cdevsw bqu_cdevsw = { bquopen, bquclose, bquread, bquwrite, /*8*/ bquioctl, nostop, nullreset, nodevtotty,/* tputer */ - bquselect, nommap, NULL, "bqu", NULL, -1 }; + bqupoll, nommap, NULL, "bqu", NULL, -1 }; static int b004_sleep; /* wait address */ @@ -467,10 +467,10 @@ bquclose(dev_t dev, int flags, int fmt, struct proc *p) } static int -bquselect(dev_t dev, int rw, struct proc *p) +bqupoll(dev_t dev, int events, struct proc *p) { /* still unimplemented */ - return(1); + return(seltrue(dev, events, p)); } /* diff --git a/sys/i386/isa/cx.c b/sys/i386/isa/cx.c index 3766ef3..b655c26 100644 --- a/sys/i386/isa/cx.c +++ b/sys/i386/isa/cx.c @@ -87,7 +87,7 @@ static d_write_t cxwrite; static d_ioctl_t cxioctl; static d_stop_t cxstop; static d_devtotty_t cxdevtotty; -static d_select_t cxselect; +static d_poll_t cxpoll; # define CDEV_MAJOR 42 @@ -95,7 +95,7 @@ static d_select_t cxselect; struct cdevsw cx_cdevsw = { cxopen, cxclose, cxread, cxwrite, /*42*/ cxioctl, cxstop, nullreset, cxdevtotty,/* cronyx */ - cxselect, nommap, NULL, "cx", NULL, -1 }; + cxpoll, nommap, NULL, "cx", NULL, -1 }; #else struct tty *cx_tty [NCX*NCHAN]; /* tty data */ #endif @@ -736,17 +736,13 @@ struct tty *cxdevtotty (dev_t dev) return (cxchan[unit]->ttyp); } -int cxselect (dev_t dev, int flag, struct proc *p) +int cxpoll (dev_t dev, int events, struct proc *p) { int unit = UNIT (dev); if (unit == UNIT_CTL || unit >= NCX*NCHAN) return (0); -#if defined (__FreeBSD__) && __FreeBSD__ < 2 - return (ttselect (dev, flag, p)); -#else /* FreeBSD 2.x and BSDI */ - return (ttyselect (cxchan[unit]->ttyp, flag, p)); -#endif + return (ttypoll (cxchan[unit]->ttyp, events, p)); } /* diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index 40f0bf3..b56fc42 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.52 1997/09/01 07:45:25 fsmp Exp $ + * $Id: cy.c,v 1.53 1997/09/03 01:50:24 bde Exp $ */ #include "cy.h" @@ -381,7 +381,7 @@ static d_devtotty_t siodevtotty; static struct cdevsw sio_cdevsw = { sioopen, sioclose, sioread, siowrite, sioioctl, siostop, noreset, siodevtotty, - ttselect, nommap, NULL, driver_name, + ttpoll, nommap, NULL, driver_name, NULL, -1, }; diff --git a/sys/i386/isa/istallion.c b/sys/i386/isa/istallion.c index d98bb2a..8dcba8e 100644 --- a/sys/i386/isa/istallion.c +++ b/sys/i386/isa/istallion.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: istallion.c,v 1.11 1997/03/24 11:23:52 bde Exp $ + * $Id: istallion.c,v 1.12 1997/07/20 14:10:04 bde Exp $ */ /*****************************************************************************/ @@ -642,7 +642,7 @@ struct isa_driver stlidriver = { static struct cdevsw stli_cdevsw = { stliopen, stliclose, stliread, stliwrite, stliioctl, stlistop, noreset, stlidevtotty, - ttselect, nommap, NULL, stli_drvname, + ttpoll, nommap, NULL, stli_drvname, NULL, -1 }; static stli_devsw_installed = 0; diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c index 091ff8c..8be260c 100644 --- a/sys/i386/isa/mse.c +++ b/sys/i386/isa/mse.c @@ -11,7 +11,7 @@ * this software for any purpose. It is provided "as is" * without express or implied warranty. * - * $Id: mse.c,v 1.32 1997/03/24 11:23:56 bde Exp $ + * $Id: mse.c,v 1.33 1997/07/20 14:10:06 bde Exp $ */ /* * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and @@ -51,6 +51,7 @@ #include <sys/conf.h> #include <sys/proc.h> #include <sys/kernel.h> +#include <sys/poll.h> #include <sys/uio.h> #ifdef DEVFS #include <sys/devfsext.h> @@ -70,13 +71,13 @@ struct isa_driver msedriver = { static d_open_t mseopen; static d_close_t mseclose; static d_read_t mseread; -static d_select_t mseselect; +static d_poll_t msepoll; #define CDEV_MAJOR 27 static struct cdevsw mse_cdevsw = { mseopen, mseclose, mseread, nowrite, /*27*/ noioc, nostop, nullreset, nodevtotty,/* mse */ - mseselect, nommap, NULL, "mse", NULL, -1 }; + msepoll, nommap, NULL, "mse", NULL, -1 }; /* @@ -365,31 +366,34 @@ mseread(dev, uio, ioflag) } /* - * mseselect: check for mouse input to be processed. + * msepoll: check for mouse input to be processed. */ static int -mseselect(dev, rw, p) +msepoll(dev, events, p) dev_t dev; - int rw; + int events; struct proc *p; { register struct mse_softc *sc = &mse_sc[MSE_UNIT(dev)]; int s; + int revents = 0; s = spltty(); - if (sc->sc_bytesread != PROTOBYTES || sc->sc_deltax != 0 || - sc->sc_deltay != 0 || (sc->sc_obuttons ^ sc->sc_buttons) != 0) { - splx(s); - return (1); - } + if (events & (POLLIN | POLLRDNORM)) + if (sc->sc_bytesread != PROTOBYTES || sc->sc_deltax != 0 || + sc->sc_deltay != 0 || + (sc->sc_obuttons ^ sc->sc_buttons) != 0) + revents |= events & (POLLIN | POLLRDNORM); + else { + /* + * Since this is an exclusive open device, any previous + * proc pointer is trash now, so we can just assign it. + */ + selrecord(p, &sc->sc_selp); + } - /* - * Since this is an exclusive open device, any previous proc. - * pointer is trash now, so we can just assign it. - */ - selrecord(p, &sc->sc_selp); splx(s); - return (0); + return (revents); } /* diff --git a/sys/i386/isa/pcaudio.c b/sys/i386/isa/pcaudio.c index 3b479a3..cd97d1a 100644 --- a/sys/i386/isa/pcaudio.c +++ b/sys/i386/isa/pcaudio.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcaudio.c,v 1.35 1997/09/03 19:08:05 sos Exp $ + * $Id: pcaudio.c,v 1.36 1997/09/06 17:38:29 helbig Exp $ */ #include "pca.h" @@ -39,6 +39,7 @@ #include <sys/proc.h> #include <sys/kernel.h> #include <sys/filio.h> +#include <sys/poll.h> #include <machine/clock.h> #include <machine/pcaudioio.h> @@ -76,7 +77,7 @@ static struct pca_status { char current; /* current buffer */ unsigned char oldval; /* old timer port value */ char timer_on; /* is playback running */ - struct selinfo wsel; /* select status */ + struct selinfo wsel; /* select/poll status */ char non_block; /* set non-block on write status */ } pca_status; @@ -105,13 +106,13 @@ static d_open_t pcaopen; static d_close_t pcaclose; static d_write_t pcawrite; static d_ioctl_t pcaioctl; -static d_select_t pcaselect; +static d_poll_t pcapoll; #define CDEV_MAJOR 24 static struct cdevsw pca_cdevsw = { pcaopen, pcaclose, noread, pcawrite, /*24*/ pcaioctl, nostop, nullreset, nodevtotty,/* pcaudio */ - pcaselect, nommap, NULL, "pca", NULL, -1 }; + pcapoll, nommap, NULL, "pca", NULL, -1 }; static void pca_continue __P((void)); static void pca_init __P((void)); @@ -488,29 +489,29 @@ pcaintr(struct clockframe *frame) static int -pcaselect(dev_t dev, int rw, struct proc *p) +pcapoll(dev_t dev, int events, struct proc *p) { - int s = spltty(); + int s; struct proc *p1; + int revents = 0; + + s = spltty(); + + if (events & (POLLOUT | POLLWRNORM)) + if (!pca_status.in_use[0] || !pca_status.in_use[1] || + !pca_status.in_use[2]) + revents |= events & (POLLOUT | POLLWRNORM); + else { + if (pca_status.wsel.si_pid && + (p1=pfind(pca_status.wsel.si_pid)) + && p1->p_wchan == (caddr_t)&selwait) + pca_status.wsel.si_flags = SI_COLL; + else + pca_status.wsel.si_pid = p->p_pid; + } - switch (rw) { - - case FWRITE: - if (!pca_status.in_use[0] || !pca_status.in_use[1] || !pca_status.in_use[2]) { - splx(s); - return(1); - } - if (pca_status.wsel.si_pid && (p1=pfind(pca_status.wsel.si_pid)) - && p1->p_wchan == (caddr_t)&selwait) - pca_status.wsel.si_flags = SI_COLL; - else - pca_status.wsel.si_pid = p->p_pid; - splx(s); - return 0; - default: - splx(s); - return(0); - } + splx(s); + return (revents); } static pca_devsw_installed = 0; diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index 2af6ddb..f0961ee 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -124,7 +124,7 @@ static d_mmap_t pcmmap; static struct cdevsw pcdevsw = { pcopen, pcclose, pcread, pcwrite, pcioctl, nullstop, noreset, pcdevtotty, - ttselect, pcmmap, nostrategy, "vt", NULL, -1 + ttpoll, pcmmap, nostrategy, "vt", NULL, -1 }; #if PCVT_FREEBSD > 205 diff --git a/sys/i386/isa/psm.c b/sys/i386/isa/psm.c index 6ed4255..432c1be 100644 --- a/sys/i386/isa/psm.c +++ b/sys/i386/isa/psm.c @@ -19,7 +19,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: psm.c,v 1.40 1997/06/30 12:52:57 yokota Exp $ + * $Id: psm.c,v 1.41 1997/07/20 14:10:08 bde Exp $ */ /* @@ -69,6 +69,7 @@ #include <sys/fcntl.h> #include <sys/proc.h> #include <sys/conf.h> +#include <sys/poll.h> #include <sys/syslog.h> #include <sys/malloc.h> #ifdef DEVFS @@ -182,7 +183,7 @@ static d_open_t psmopen; static d_close_t psmclose; static d_read_t psmread; static d_ioctl_t psmioctl; -static d_select_t psmselect; +static d_poll_t psmpoll; static int enable_aux_dev __P((KBDC)); static int disable_aux_dev __P((KBDC)); @@ -211,7 +212,7 @@ struct isa_driver psmdriver = { psmprobe, psmattach, "psm", FALSE }; static struct cdevsw psm_cdevsw = { psmopen, psmclose, psmread, nowrite, /* 21 */ psmioctl, nostop, nullreset, nodevtotty, - psmselect, nommap, NULL, "psm", NULL, -1 + psmpoll, nommap, NULL, "psm", NULL, -1 }; /* debug message level */ @@ -1589,27 +1590,23 @@ psmintr(int unit) } static int -psmselect(dev_t dev, int rw, struct proc *p) +psmpoll(dev_t dev, int events, struct proc *p) { struct psm_softc *sc = psm_softc[PSM_UNIT(dev)]; - int ret; int s; - - /* Silly to select for output */ - if (rw == FWRITE) - return (0); + int revents = 0; /* Return true if a mouse event available */ s = spltty(); - if ((sc->outputbytes > 0) || (sc->queue.count > 0)) { - ret = 1; - } else { - selrecord(p, &sc->rsel); - ret = 0; - } + if (events & (POLLIN | POLLRDNORM)) + if ((sc->outputbytes > 0) || (sc->queue.count > 0)) + revents |= events & (POLLIN | POLLRDNORM); + else + selrecord(p, &sc->rsel); + splx(s); - return (ret); + return (revents); } static int psm_devsw_installed = FALSE; diff --git a/sys/i386/isa/qcam.c b/sys/i386/isa/qcam.c index 85ced2b..a643dbc 100644 --- a/sys/i386/isa/qcam.c +++ b/sys/i386/isa/qcam.c @@ -69,7 +69,7 @@ static d_ioctl_t qcam_ioctl; static struct cdevsw qcam_cdevsw = { qcam_open, qcam_close, qcam_read, nowrite, qcam_ioctl, nostop, nullreset, nodevtotty, - noselect, nommap, nostrategy, "qcam", + seltrue, nommap, nostrategy, "qcam", NULL, -1 }; static int qcam_probe(struct isa_device *devp); diff --git a/sys/i386/isa/random_machdep.c b/sys/i386/isa/random_machdep.c index affe38f..70d3c95 100644 --- a/sys/i386/isa/random_machdep.c +++ b/sys/i386/isa/random_machdep.c @@ -1,7 +1,7 @@ /* * random_machdep.c -- A strong random number generator * - * $Id: random_machdep.c,v 1.16 1997/04/26 11:46:03 peter Exp $ + * $Id: random_machdep.c,v 1.17 1997/05/04 14:28:22 peter Exp $ * * Version 0.95, last modified 18-Oct-95 * @@ -45,6 +45,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/select.h> +#include <sys/poll.h> #include <sys/fcntl.h> #include <machine/clock.h> @@ -494,22 +495,22 @@ write_random(const char *buf, u_int nbytes) #endif /* notused */ int -random_select(dev_t dev, int rw, struct proc *p) +random_poll(dev_t dev, int events, struct proc *p) { - int s, ret; - - if (rw == FWRITE) - return 1; /* heh. */ + int s; + int revents = 0; s = splhigh(); - if (random_state.entropy_count >= 8) - ret = 1; - else { - selrecord(p, &random_state.rsel); - ret = 0; - } + if (events & (POLLIN | POLLRDNORM)) + if (random_state.entropy_count >= 8) + revents |= events & (POLLIN | POLLRDNORM); + else + selrecord(p, &random_state.rsel); + splx(s); + if (events & (POLLOUT | POLLWRNORM)) + revents |= events & (POLLOUT | POLLWRNORM); /* heh */ - return ret; + return (revents); } diff --git a/sys/i386/isa/rc.c b/sys/i386/isa/rc.c index 8a721e0..541e3f5 100644 --- a/sys/i386/isa/rc.c +++ b/sys/i386/isa/rc.c @@ -107,7 +107,7 @@ static d_devtotty_t rcdevtotty; static struct cdevsw rc_cdevsw = { rcopen, rcclose, rcread, rcwrite, /*63*/ rcioctl, rcstop, noreset, rcdevtotty,/* rc */ - ttselect, nommap, NULL, "rc", NULL, -1 }; + ttpoll, nommap, NULL, "rc", NULL, -1 }; /* Per-board structure */ static struct rc_softc { diff --git a/sys/i386/isa/rp.c b/sys/i386/isa/rp.c index 8b0ef3e..0403e89 100644 --- a/sys/i386/isa/rp.c +++ b/sys/i386/isa/rp.c @@ -801,7 +801,7 @@ static d_devtotty_t rpdevtotty; static struct cdevsw rp_cdevsw = { rpopen, rpclose, rpread, rpwrite, rpioctl, rpstop, noreset, rpdevtotty, - ttselect, nommap, NULL, driver_name, + ttpoll, nommap, NULL, driver_name, NULL, -1}; static int rp_controller_port = 0; diff --git a/sys/i386/isa/si.c b/sys/i386/isa/si.c index 86b9de4..bd756a3 100644 --- a/sys/i386/isa/si.c +++ b/sys/i386/isa/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.58 1997/04/20 15:36:04 bde Exp $ + * $Id: si.c,v 1.59 1997/07/20 14:10:11 bde Exp $ */ #ifndef lint @@ -122,7 +122,7 @@ static d_devtotty_t sidevtotty; static struct cdevsw si_cdevsw = { siopen, siclose, siread, siwrite, /*68*/ siioctl, sistop, noreset, sidevtotty,/* si */ - ttselect, nommap, NULL, "si", NULL, -1 }; + ttpoll, nommap, NULL, "si", NULL, -1 }; #ifdef SI_DEBUG /* use: ``options "SI_DEBUG"'' in your config file */ diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index 5cf4f65..d7bebbb 100644 --- a/sys/i386/isa/sio.c +++ b/sys/i386/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.11 1997/09/01 07:37:01 smp Exp smp $ + * $Id: sio.c,v 1.180 1997/09/01 07:45:28 fsmp Exp $ */ #include "opt_comconsole.h" @@ -348,7 +348,7 @@ static d_devtotty_t siodevtotty; static struct cdevsw sio_cdevsw = { sioopen, sioclose, sioread, siowrite, sioioctl, siostop, noreset, siodevtotty, - ttselect, nommap, NULL, driver_name, + ttpoll, nommap, NULL, driver_name, NULL, -1, }; diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c index 1809356..44415a6 100644 --- a/sys/i386/isa/spigot.c +++ b/sys/i386/isa/spigot.c @@ -96,14 +96,13 @@ static d_close_t spigot_close; static d_read_t spigot_read; static d_write_t spigot_write; static d_ioctl_t spigot_ioctl; -static d_select_t spigot_select; static d_mmap_t spigot_mmap; #define CDEV_MAJOR 11 static struct cdevsw spigot_cdevsw = { spigot_open, spigot_close, spigot_read, spigot_write, /*11*/ spigot_ioctl, nostop, nullreset, nodevtotty,/* Spigot */ - spigot_select, spigot_mmap, NULL, "spigot", NULL, -1 }; + seltrue, spigot_mmap, NULL, "spigot", NULL, -1 }; static int spigot_probe(struct isa_device *devp) @@ -240,13 +239,6 @@ struct spigot_info *info; return 0; } -static int -spigot_select(dev_t dev, int rw, struct proc *p) -{ - - return ENXIO; -} - /* * Interrupt procedure. * Just call a user level interrupt routine. diff --git a/sys/i386/isa/stallion.c b/sys/i386/isa/stallion.c index 0feff74..610f2a6 100644 --- a/sys/i386/isa/stallion.c +++ b/sys/i386/isa/stallion.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: stallion.c,v 1.11 1997/03/24 21:38:51 davidn Exp $ + * $Id: stallion.c,v 1.12 1997/07/20 14:10:12 bde Exp $ */ /*****************************************************************************/ @@ -537,7 +537,7 @@ DATA_SET (pcidevice_set, stlpcidriver); static struct cdevsw stl_cdevsw = { stlopen, stlclose, stlread, stlwrite, stlioctl, stlstop, noreset, stldevtotty, - ttselect, nommap, NULL, "stl", NULL, -1 }; + ttpoll, nommap, NULL, "stl", NULL, -1 }; static stl_devsw_installed = 0; diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index 25bf831..d9fe634 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.230 1997/08/09 19:24:03 sos Exp $ + * $Id: syscons.c,v 1.231 1997/09/04 23:01:03 yokota Exp $ */ #include "sc.h" @@ -250,7 +250,7 @@ static d_mmap_t scmmap; static struct cdevsw scdevsw = { scopen, scclose, scread, scwrite, scioctl, nullstop, noreset, scdevtotty, - ttselect, scmmap, nostrategy, "sc", NULL, -1 }; + ttpoll, scmmap, nostrategy, "sc", NULL, -1 }; /* * These functions need to be before calls to them so they can be inlined. diff --git a/sys/i386/isa/tw.c b/sys/i386/isa/tw.c index 2673a14..6c08fae 100644 --- a/sys/i386/isa/tw.c +++ b/sys/i386/isa/tw.c @@ -145,6 +145,7 @@ #include <sys/uio.h> #include <sys/syslog.h> #include <sys/select.h> +#include <sys/poll.h> #ifdef DEVFS #include <sys/devfsext.h> #endif /*DEVFS*/ @@ -215,13 +216,13 @@ static d_open_t twopen; static d_close_t twclose; static d_read_t twread; static d_write_t twwrite; -static d_select_t twselect; +static d_poll_t twpoll; #define CDEV_MAJOR 19 static struct cdevsw tw_cdevsw = { twopen, twclose, twread, twwrite, /*19*/ noioc, nullstop, nullreset, nodevtotty, /* tw */ - twselect, nommap, nostrat, "tw", NULL, -1 }; + twpoll, nommap, nostrat, "tw", NULL, -1 }; /* * Software control structure for TW523 @@ -526,24 +527,26 @@ int twwrite(dev, uio, ioflag) * Determine if there is data available for reading */ -int twselect(dev, rw, p) +int twpoll(dev, events, p) dev_t dev; - int rw; + int events; struct proc *p; { struct tw_sc *sc; - struct proc *pp; - int s, i; + int s; + int revents = 0; sc = &tw_sc[TWUNIT(dev)]; s = spltty(); - if(sc->sc_nextin != sc->sc_nextout) { - splx(s); - return(1); - } - selrecord(p, &sc->sc_selp); + /* XXX is this correct? the original code didn't test select rw mode!! */ + if (events & (POLLIN | POLLRDNORM)) + if(sc->sc_nextin != sc->sc_nextout) + revents |= events & (POLLIN | POLLRDNORM); + else + selrecord(p, &sc->sc_selp); + splx(s); - return(0); + return(revents); } /* diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 5cf4f65..d7bebbb 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.11 1997/09/01 07:37:01 smp Exp smp $ + * $Id: sio.c,v 1.180 1997/09/01 07:45:28 fsmp Exp $ */ #include "opt_comconsole.h" @@ -348,7 +348,7 @@ static d_devtotty_t siodevtotty; static struct cdevsw sio_cdevsw = { sioopen, sioclose, sioread, siowrite, sioioctl, siostop, noreset, siodevtotty, - ttselect, nommap, NULL, driver_name, + ttpoll, nommap, NULL, driver_name, NULL, -1, }; diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c index 25bf831..d9fe634 100644 --- a/sys/isa/syscons.c +++ b/sys/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.230 1997/08/09 19:24:03 sos Exp $ + * $Id: syscons.c,v 1.231 1997/09/04 23:01:03 yokota Exp $ */ #include "sc.h" @@ -250,7 +250,7 @@ static d_mmap_t scmmap; static struct cdevsw scdevsw = { scopen, scclose, scread, scwrite, scioctl, nullstop, noreset, scdevtotty, - ttselect, scmmap, nostrategy, "sc", NULL, -1 }; + ttpoll, scmmap, nostrategy, "sc", NULL, -1 }; /* * These functions need to be before calls to them so they can be inlined. diff --git a/sys/kern/kern_random.c b/sys/kern/kern_random.c index affe38f..70d3c95 100644 --- a/sys/kern/kern_random.c +++ b/sys/kern/kern_random.c @@ -1,7 +1,7 @@ /* * random_machdep.c -- A strong random number generator * - * $Id: random_machdep.c,v 1.16 1997/04/26 11:46:03 peter Exp $ + * $Id: random_machdep.c,v 1.17 1997/05/04 14:28:22 peter Exp $ * * Version 0.95, last modified 18-Oct-95 * @@ -45,6 +45,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/select.h> +#include <sys/poll.h> #include <sys/fcntl.h> #include <machine/clock.h> @@ -494,22 +495,22 @@ write_random(const char *buf, u_int nbytes) #endif /* notused */ int -random_select(dev_t dev, int rw, struct proc *p) +random_poll(dev_t dev, int events, struct proc *p) { - int s, ret; - - if (rw == FWRITE) - return 1; /* heh. */ + int s; + int revents = 0; s = splhigh(); - if (random_state.entropy_count >= 8) - ret = 1; - else { - selrecord(p, &random_state.rsel); - ret = 0; - } + if (events & (POLLIN | POLLRDNORM)) + if (random_state.entropy_count >= 8) + revents |= events & (POLLIN | POLLRDNORM); + else + selrecord(p, &random_state.rsel); + splx(s); + if (events & (POLLOUT | POLLWRNORM)) + revents |= events & (POLLOUT | POLLWRNORM); /* heh */ - return ret; + return (revents); } diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 0f8c57d..1da0188 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.53 1997/08/08 20:09:50 julian Exp $ + * $Id: cons.c,v 1.54 1997/08/08 20:29:47 julian Exp $ */ #include <sys/param.h> @@ -76,13 +76,13 @@ static d_close_t cnclose; static d_read_t cnread; static d_write_t cnwrite; static d_ioctl_t cnioctl; -static d_select_t cnselect; +static d_poll_t cnpoll; #define CDEV_MAJOR 0 static struct cdevsw cn_cdevsw = { cnopen, cnclose, cnread, cnwrite, /*0*/ cnioctl, nullstop, nullreset, nodevtotty,/* console */ - cnselect, nommap, NULL, "console", NULL, -1 }; + cnpoll, nommap, NULL, "console", NULL, -1 }; static dev_t cn_dev_t; /* seems to be never really used */ SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD, @@ -374,9 +374,9 @@ cnioctl(dev, cmd, data, flag, p) } static int -cnselect(dev, rw, p) +cnpoll(dev, events, p) dev_t dev; - int rw; + int events; struct proc *p; { if ((cn_tab == NULL) || cn_mute) @@ -384,7 +384,7 @@ cnselect(dev, rw, p) dev = cn_tab->cn_dev; - return ((*cdevsw[major(dev)]->d_select)(dev, rw, p)); + return ((*cdevsw[major(dev)]->d_poll)(dev, events, p)); } int diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index 541b4af..7383566 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -41,6 +41,7 @@ #include <sys/devfsext.h> #endif /*DEVFS*/ #include <sys/uio.h> +#include <sys/poll.h> #include <i386/isa/isa_device.h> #include <i386/isa/icu.h> @@ -113,13 +114,13 @@ static d_close_t crdclose; static d_read_t crdread; static d_write_t crdwrite; static d_ioctl_t crdioctl; -static d_select_t crdselect; +static d_poll_t crdpoll; #define CDEV_MAJOR 50 static struct cdevsw crd_cdevsw = { crdopen, crdclose, crdread, crdwrite, /*50*/ crdioctl, nostop, nullreset, nodevtotty,/* pcmcia */ - crdselect, nommap, NULL, "crd", NULL, -1 }; + crdpoll, nommap, NULL, "crd", NULL, -1 }; /* @@ -985,33 +986,35 @@ crdioctl(dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p) } /* - * select - Selects on exceptions will return true + * poll - Poll on exceptions will return true * when a change in card status occurs. */ static int -crdselect(dev_t dev, int rw, struct proc *p) +crdpoll(dev_t dev, int events, struct proc *p) { int s; struct slot *sp = pccard_slots[minor(dev)]; + int revents = 0; - switch (rw) { - case FREAD: - return 1; - case FWRITE: - return 1; + if (events & (POLLIN | POLLRDNORM)) + revents |= events & (POLLIN | POLLRDNORM); + + if (events & (POLLOUT | POLLWRNORM)) + revents |= events & (POLLIN | POLLRDNORM); + + s = splhigh(); /* * select for exception - card event. */ - case 0: - s = splhigh(); - if (sp == 0 || sp->laststate != sp->state) { - splx(s); - return(1); - } + if (events & POLLRDBAND) + if (sp == 0 || sp->laststate != sp->state) + revents |= POLLRDBAND; + + if (revents == 0) selrecord(p, &sp->selp); - splx(s); - } - return(0); + + splx(s); + return (revents); } /* diff --git a/sys/pci/pci.c b/sys/pci/pci.c index bb5a0f8..468ec05 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pci.c,v 1.77 1997/06/25 20:56:29 fsmp Exp $ + * $Id: pci.c,v 1.78 1997/08/02 14:33:12 bde Exp $ * */ @@ -569,7 +569,7 @@ static unsigned pci_dev_list_size; static struct cdevsw pcicdev = { pci_open, pci_close, noread, nowrite, pci_ioctl, nostop, noreset, - nodevtotty, noselect, nommap, nostrategy, "pci", 0, PCI_CDEV + nodevtotty, seltrue, nommap, nostrategy, "pci", 0, PCI_CDEV }; #ifdef DEVFS diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c index f68f65a..53e598a 100644 --- a/sys/scsi/ch.c +++ b/sys/scsi/ch.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ch.c,v 1.40 1997/03/24 11:24:55 bde Exp $ + * $Id: ch.c,v 1.41 1997/09/02 20:06:31 bde Exp $ */ #include <sys/param.h> @@ -108,7 +108,7 @@ static d_ioctl_t chioctl; static struct cdevsw ch_cdevsw = { chopen, chclose, noread, nowrite, /*17*/ chioctl, nostop, nullreset, nodevtotty,/* ch */ - noselect, nommap, nostrat, "ch", NULL, -1 }; + seltrue, nommap, nostrat, "ch", NULL, -1 }; /* * SCSI glue. diff --git a/sys/scsi/ssc.c b/sys/scsi/ssc.c index 5002d02..7d84406 100644 --- a/sys/scsi/ssc.c +++ b/sys/scsi/ssc.c @@ -49,10 +49,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *End copyright - * $Id: ssc.c,v 1.14 1997/02/22 09:44:38 peter Exp $ + * $Id: ssc.c,v 1.15 1997/08/02 14:33:16 bde Exp $ */ #include <sys/param.h> +#include <sys/systm.h> #include <sys/conf.h> #include <sys/scsiio.h> #include <sys/kernel.h> @@ -74,7 +75,7 @@ extern d_ioctl_t suioctl; static struct cdevsw ssc_cdevsw = { sscopen, sscclose, noread, nowrite, /*49*/ sscioctl, nostop, nullreset, nodevtotty, - noselect, nommap, nostrategy, "ssc", NULL, -1 }; + seltrue, nommap, nostrategy, "ssc", NULL, -1 }; static dev_t sscdev = NODEV; diff --git a/sys/scsi/su.c b/sys/scsi/su.c index 434d9fd..6f22606 100644 --- a/sys/scsi/su.c +++ b/sys/scsi/su.c @@ -44,7 +44,7 @@ * SUCH DAMAGE. *End copyright * - * $Id: su.c,v 1.16 1997/02/22 09:44:40 peter Exp $ + * $Id: su.c,v 1.17 1997/09/02 20:06:40 bde Exp $ * * Tabstops 4 * XXX devfs entries for this device should be handled by generic scsiconfig @@ -52,6 +52,7 @@ */ #include <sys/param.h> +#include <sys/systm.h> #include <sys/conf.h> #include <sys/stat.h> #include <sys/buf.h> @@ -66,13 +67,13 @@ extern d_ioctl_t suioctl; static d_read_t suread; static d_write_t suwrite; -static d_select_t suselect; +static d_poll_t supoll; static d_strategy_t sustrategy; static struct cdevsw su_cdevsw = { suopen, suclose, suread, suwrite, /*18*/ suioctl, nostop, nullreset, nodevtotty,/* scsi */ - suselect, nommap, sustrategy, "su", NULL, -1 }; + supoll, nommap, sustrategy, "su", NULL, -1 }; /* Build an old style device number (unit encoded in the minor number) @@ -112,7 +113,7 @@ static struct cdevsw cnxio = { nxstop, nxreset, nxdevtotty, - nxselect, + seltrue, nxmmap, nxstrategy, "NON", @@ -278,14 +279,14 @@ suwrite(dev_t dev, struct uio *uio, int ioflag) } static int -suselect(dev_t dev, int which, struct proc *p) +supoll(dev_t dev, int events, struct proc *p) { dev_t base; struct cdevsw *cdev; (void)getsws(dev, S_IFCHR, 0, &cdev, &base); - return (*cdev->d_select)(base, which, p); + return (*cdev->d_poll)(base, events, p); } static su_devsw_installed = 0; diff --git a/sys/sys/random.h b/sys/sys/random.h index 659fdf9..b2b7d12 100644 --- a/sys/sys/random.h +++ b/sys/sys/random.h @@ -1,7 +1,7 @@ /* * random.h -- A strong random number generator * - * $Id: random.h,v 1.11 1997/02/22 09:35:05 peter Exp $ + * $Id: random.h,v 1.12 1997/06/07 00:57:26 bde Exp $ * * Version 0.95, last modified 18-Oct-95 * @@ -80,7 +80,7 @@ u_int read_random_unlimited(char *buf, u_int size); #ifdef notused u_int write_random(const char *buf, u_int nbytes); #endif -int random_select(dev_t dev, int rw, struct proc *p); +int random_poll(dev_t dev, int events, struct proc *p); #endif /* KERNEL */ diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index bff7fb2..1b9112e 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)vm_swap.c 8.5 (Berkeley) 2/17/94 - * $Id: vm_swap.c,v 1.45 1997/09/01 03:17:30 bde Exp $ + * $Id: vm_swap.c,v 1.46 1997/09/07 16:21:11 bde Exp $ */ #include <sys/param.h> @@ -78,7 +78,7 @@ static struct bdevsw sw_bdevsw = static struct cdevsw sw_cdevsw = { nullopen, nullclose, rawread, rawwrite, /*4*/ noioc, nostop, noreset, nodevtotty,/* swap */ - noselect, nommap, swstrategy, "sw", + seltrue, nommap, swstrategy, "sw", &sw_bdevsw, -1 }; static dev_t swapdev = makedev(BDEV_MAJOR, 0); |