summaryrefslogtreecommitdiff
path: root/sys/miscfs/kernfs
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-09-23 16:51:15 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-09-23 16:51:15 +0000
commit6bb276a1685d8546283d224a3d249c66cc329264 (patch)
tree5e1c80d6cad38a8a82f5832e1e315103e7029eb9 /sys/miscfs/kernfs
parent96675671ec2520ade2f83b31563ab4da72bd443d (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/miscfs/kernfs')
-rw-r--r--sys/miscfs/kernfs/kernfs.h3
-rw-r--r--sys/miscfs/kernfs/kernfs_vnops.c19
2 files changed, 18 insertions, 4 deletions
diff --git a/sys/miscfs/kernfs/kernfs.h b/sys/miscfs/kernfs/kernfs.h
index 4083055821a..8feda932cdb 100644
--- a/sys/miscfs/kernfs/kernfs.h
+++ b/sys/miscfs/kernfs/kernfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: kernfs.h,v 1.13 2003/08/14 07:46:39 mickey Exp $ */
+/* $OpenBSD: kernfs.h,v 1.14 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: kernfs.h,v 1.10 1996/02/09 22:40:21 christos Exp $ */
/*
@@ -94,6 +94,7 @@ struct kernfs_node {
int *, struct ucred **))eopnotsupp)
int kernfs_init(struct vfsconf *);
+int kernfs_poll(void *);
int kernfs_allocvp(const struct kern_target *, struct mount *, struct vnode **);
const struct kern_target *kernfs_findtarget(char *, int);
extern int (**kernfs_vnodeop_p)(void *);
diff --git a/sys/miscfs/kernfs/kernfs_vnops.c b/sys/miscfs/kernfs/kernfs_vnops.c
index 26b2bd535f5..c6b834fd24e 100644
--- a/sys/miscfs/kernfs/kernfs_vnops.c
+++ b/sys/miscfs/kernfs/kernfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kernfs_vnops.c,v 1.34 2003/08/11 10:19:24 mickey Exp $ */
+/* $OpenBSD: kernfs_vnops.c,v 1.35 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: kernfs_vnops.c,v 1.43 1996/03/16 23:52:47 christos Exp $ */
/*
@@ -54,6 +54,7 @@
#include <sys/buf.h>
#include <sys/dirent.h>
#include <sys/msgbuf.h>
+#include <sys/poll.h>
#include <miscfs/kernfs/kernfs.h>
#include <uvm/uvm_extern.h>
@@ -126,7 +127,6 @@ int kernfs_setattr(void *);
int kernfs_read(void *);
int kernfs_write(void *);
#define kernfs_ioctl (int (*)(void *))enoioctl
-#define kernfs_select eopnotsupp
#define kernfs_mmap eopnotsupp
#define kernfs_fsync nullop
#define kernfs_seek nullop
@@ -174,7 +174,7 @@ struct vnodeopv_entry_desc kernfs_vnodeop_entries[] = {
{ &vop_read_desc, kernfs_read }, /* read */
{ &vop_write_desc, kernfs_write }, /* write */
{ &vop_ioctl_desc, kernfs_ioctl }, /* ioctl */
- { &vop_select_desc, kernfs_select }, /* select */
+ { &vop_poll_desc, kernfs_poll }, /* poll */
{ &vop_revoke_desc, kernfs_revoke }, /* revoke */
{ &vop_fsync_desc, kernfs_fsync }, /* fsync */
{ &vop_remove_desc, kernfs_remove }, /* remove */
@@ -948,3 +948,16 @@ kernfs_badop(v)
panic("kernfs: bad op");
return 0;
}
+
+int
+kernfs_poll(v)
+ void *v;
+{
+ struct vop_poll_args /* {
+ struct vnode *a_vp;
+ int a_events;
+ struct proc *a_p;
+ } */ *ap = v;
+
+ return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
+}