summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-03-06 15:35:37 +0000
committerkib <kib@FreeBSD.org>2009-03-06 15:35:37 +0000
commit84bab6f2a5f7b42982b7a5b58805d10cb9d29094 (patch)
tree2a39e9e4c6d5ba830ca005f28538680b257d514a /sys/kern
parent02189c9e63999a6f37cb1f690929e719fea7bb92 (diff)
downloadFreeBSD-src-84bab6f2a5f7b42982b7a5b58805d10cb9d29094.zip
FreeBSD-src-84bab6f2a5f7b42982b7a5b58805d10cb9d29094.tar.gz
Extract the no_poll() and vop_nopoll() code into the common routine
poll_no_poll(). Return a poll_no_poll() result from devfs_poll_f() when filedescriptor does not reference the live cdev, instead of ENXIO. Noted and tested by: hps MFC after: 1 week
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_conf.c12
-rw-r--r--sys/kern/sys_generic.c16
-rw-r--r--sys/kern/vfs_default.c12
3 files changed, 18 insertions, 22 deletions
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));
}
/*
OpenPOWER on IntegriCloud