summaryrefslogtreecommitdiff
path: root/sys/miscfs/procfs
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/procfs
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/procfs')
-rw-r--r--sys/miscfs/procfs/procfs.h3
-rw-r--r--sys/miscfs/procfs/procfs_vnops.c18
2 files changed, 17 insertions, 4 deletions
diff --git a/sys/miscfs/procfs/procfs.h b/sys/miscfs/procfs/procfs.h
index c590f949c76..ced28816398 100644
--- a/sys/miscfs/procfs/procfs.h
+++ b/sys/miscfs/procfs/procfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs.h,v 1.21 2003/08/14 07:46:40 mickey Exp $ */
+/* $OpenBSD: procfs.h,v 1.22 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: procfs.h,v 1.17 1996/02/12 15:01:41 christos Exp $ */
/*
@@ -124,6 +124,7 @@ int procfs_docpuinfo(struct proc *, struct proc *, struct pfsnode *pfsp, struct
int procfs_domap(struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio, int);
int procfs_freevp(struct vnode *);
int procfs_getcpuinfstr(char *, int *);
+int procfs_poll(void *);
/* functions to check whether or not files should be displayed */
int procfs_validfile(struct proc *, struct mount *);
diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c
index 82fb17f7aa6..40da1bc0c2f 100644
--- a/sys/miscfs/procfs/procfs_vnops.c
+++ b/sys/miscfs/procfs/procfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs_vnops.c,v 1.29 2003/06/02 23:28:11 millert Exp $ */
+/* $OpenBSD: procfs_vnops.c,v 1.30 2003/09/23 16:51:13 millert Exp $ */
/* $NetBSD: procfs_vnops.c,v 1.40 1996/03/16 23:52:55 christos Exp $ */
/*
@@ -52,6 +52,7 @@
#include <sys/malloc.h>
#include <sys/dirent.h>
#include <sys/resourcevar.h>
+#include <sys/poll.h>
#include <sys/ptrace.h>
#include <sys/stat.h>
@@ -131,7 +132,6 @@ int procfs_setattr(void *);
#define procfs_read procfs_rw
#define procfs_write procfs_rw
int procfs_ioctl(void *);
-#define procfs_select procfs_badop
#define procfs_fsync procfs_badop
#define procfs_remove procfs_badop
int procfs_link(void *);
@@ -171,7 +171,7 @@ struct vnodeopv_entry_desc procfs_vnodeop_entries[] = {
{ &vop_read_desc, procfs_read }, /* read */
{ &vop_write_desc, procfs_write }, /* write */
{ &vop_ioctl_desc, procfs_ioctl }, /* ioctl */
- { &vop_select_desc, procfs_select }, /* select */
+ { &vop_poll_desc, procfs_poll }, /* poll */
{ &vop_fsync_desc, procfs_fsync }, /* fsync */
{ &vop_remove_desc, procfs_remove }, /* remove */
{ &vop_link_desc, procfs_link }, /* link */
@@ -1122,3 +1122,15 @@ atopid(b, len)
return (p);
}
+int
+procfs_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));
+}