summaryrefslogtreecommitdiff
path: root/sys/dev/snp
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1997-09-14 02:42:03 +0000
committerPeter Wemm <peter@FreeBSD.org>1997-09-14 02:42:03 +0000
commit659ffb486aa1c0a7ef1dcc0d0c5282b41895492e (patch)
tree24555f6e6b1ed7970ef2522e86785c6ee5815a8e /sys/dev/snp
parent6183953301149ee7b348aaee3ced0226a7be15ff (diff)
Notes
Diffstat (limited to 'sys/dev/snp')
-rw-r--r--sys/dev/snp/snp.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c
index 6e2bf5df5b7f..9dbb3ea29199 100644
--- a/sys/dev/snp/snp.c
+++ b/sys/dev/snp/snp.c
@@ -25,6 +25,7 @@
#include <sys/tty.h>
#include <sys/fcntl.h>
#include <sys/conf.h>
+#include <sys/poll.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
@@ -39,13 +40,13 @@ static d_close_t snpclose;
static d_read_t snpread;
static d_write_t snpwrite;
static d_ioctl_t snpioctl;
-static d_select_t snpselect;
+static d_poll_t snppoll;
#define CDEV_MAJOR 53
static struct cdevsw snp_cdevsw =
{ snpopen, snpclose, snpread, snpwrite, /*53*/
snpioctl, nostop, nullreset, nodevtotty,/* snoop */
- snpselect, nommap, NULL, "snp", NULL, -1 };
+ snppoll, nommap, NULL, "snp", NULL, -1 };
#ifndef MIN
@@ -489,30 +490,28 @@ snpioctl(dev, cmd, data, flags, p)
static int
-snpselect(dev, rw, p)
+snppoll(dev, events, p)
dev_t dev;
- int rw;
+ int events;
struct proc *p;
{
int unit = minor(dev);
struct snoop *snp = &snoopsw[unit];
+ int revents = 0;
- if (rw != FREAD)
- return 1;
-
- if (snp->snp_len > 0)
- return 1;
/*
- * If snoop is down,we don't want to select() forever so we return 1.
+ * If snoop is down,we don't want to poll() forever so we return 1.
* Caller should see if we down via FIONREAD ioctl().The last should
* return -1 to indicate down state.
*/
- if (snp->snp_flags & SNOOP_DOWN)
- return 1;
+ if (events & (POLLIN | POLLRDNORM))
+ if (snp->snp_flags & SNOOP_DOWN || snp->snp_len > 0)
+ revents |= events & (POLLIN | POLLRDNORM);
+ else
+ selrecord(p, &snp->snp_sel);
- selrecord(p, &snp->snp_sel);
- return 0;
+ return (revents);
}
#ifdef DEVFS