diff options
-rw-r--r-- | sys/fs/devfs/devfs_vnops.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_conf.c | 12 | ||||
-rw-r--r-- | sys/kern/sys_generic.c | 16 | ||||
-rw-r--r-- | sys/kern/vfs_default.c | 12 | ||||
-rw-r--r-- | sys/sys/systm.h | 2 |
5 files changed, 21 insertions, 23 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index e164dc2..1087452 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -1014,7 +1014,7 @@ devfs_poll_f(struct file *fp, int events, struct ucred *cred, struct thread *td) fpop = td->td_fpop; error = devfs_fp_check(fp, &dev, &dsw); if (error) - return (error); + return (poll_no_poll(events)); error = dsw->d_poll(dev, events, td); td->td_fpop = fpop; dev_relthread(dev); diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index fb18b34..3ef55ea 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -312,18 +312,8 @@ no_strategy(struct bio *bp) static int no_poll(struct cdev *dev __unused, int events, struct thread *td __unused) { - /* - * Return true for read/write. If the user asked for something - * special, return POLLNVAL, so that clients have a way of - * determining reliably whether or not the extended - * functionality is present without hard-coding knowledge - * of specific filesystem implementations. - * Stay in sync with vop_nopoll(). - */ - if (events & ~POLLSTANDARD) - return (POLLNVAL); - return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); + return (poll_no_poll(events)); } #define no_dump (dumper_t *)enodev diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 3209610..ad7c32e 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -731,6 +731,22 @@ out: return (error); } +int +poll_no_poll(int events) +{ + /* + * Return true for read/write. If the user asked for something + * special, return POLLNVAL, so that clients have a way of + * determining reliably whether or not the extended + * functionality is present without hard-coding knowledge + * of specific filesystem implementations. + */ + if (events & ~POLLSTANDARD) + return (POLLNVAL); + + return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); +} + #ifndef _SYS_SYSPROTO_H_ struct select_args { int nd; diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index a3f3725..e047a90 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -354,18 +354,8 @@ vop_nopoll(ap) struct thread *a_td; } */ *ap; { - /* - * Return true for read/write. If the user asked for something - * special, return POLLNVAL, so that clients have a way of - * determining reliably whether or not the extended - * functionality is present without hard-coding knowledge - * of specific filesystem implementations. - * Stay in sync with kern_conf.c::no_poll(). - */ - if (ap->a_events & ~POLLSTANDARD) - return (POLLNVAL); - return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); + return (poll_no_poll(ap->a_events)); } /* diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 5dba512..31fb750 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -317,6 +317,8 @@ struct cdev; dev_t dev2udev(struct cdev *x); const char *devtoname(struct cdev *cdev); +int poll_no_poll(int events); + /* XXX: Should be void nanodelay(u_int nsec); */ void DELAY(int usec); |