From 6bb276a1685d8546283d224a3d249c66cc329264 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 23 Sep 2003 16:51:15 +0000 Subject: 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 --- sys/miscfs/procfs/procfs.h | 3 ++- sys/miscfs/procfs/procfs_vnops.c | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'sys/miscfs/procfs') 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 #include #include +#include #include #include @@ -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)); +} -- cgit v1.2.3