On Tuesday, 26.05.2015 at 15:09, Antti Kantee wrote:
> On 26/05/15 15:00, Martin Lucina wrote:
> >+static int
> >+rumpcons_poll(struct file *fp, int events)
> >+{
> >+    int revents = 0;
> >+
> >+    if (events & (POLLOUT | POLLWRNORM))
> >+            revents |= POLLOUT | POLLWRNORM;
> >+
> >+    return revents;
> >+}
> 
> Why not "events & (POLLOUT|POLLWRNORM)"?  Is it always supposed to
> return both even if not asked for?

Indeed not. Updated patch follows.


diff --git a/sys/rump/librump/rumpkern/cons.c b/sys/rump/librump/rumpkern/cons.c
index f55a02b..0d36439 100644
--- a/sys/rump/librump/rumpkern/cons.c
+++ b/sys/rump/librump/rumpkern/cons.c
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.4 2014/08/25 14:58:48 
pooka Exp $");
 #include <sys/ioctl.h>
 #include <sys/kernel.h>
 #include <sys/kmem.h>
+#include <sys/poll.h>
 #include <sys/proc.h>
 #include <sys/stat.h>
 #include <sys/termios.h>
@@ -56,13 +57,14 @@ static int rumpcons_write(struct file *, off_t *, struct 
uio *,
                          kauth_cred_t, int);
 static int rumpcons_ioctl(struct file *, u_long, void *);
 static int rumpcons_stat(struct file *, struct stat *);
+static int rumpcons_poll(struct file *, int events);
 
 static const struct fileops rumpcons_fileops = {
        .fo_read = (void *)nullop,
        .fo_write = rumpcons_write,
        .fo_ioctl = rumpcons_ioctl,
        .fo_fcntl = fnullop_fcntl,
-       .fo_poll = fnullop_poll,
+       .fo_poll = rumpcons_poll,
        .fo_stat = rumpcons_stat,
        .fo_close = (void *)nullop,
        .fo_kqfilter = fnullop_kqfilter,
@@ -142,3 +144,14 @@ rumpcons_stat(struct file *fp, struct stat *sb)
 
        return 0;
 }
+
+static int
+rumpcons_poll(struct file *fp, int events)
+{
+       int revents = 0;
+
+       if (events & (POLLOUT | POLLWRNORM))
+               revents |= events & (POLLOUT | POLLWRNORM);
+
+       return revents;
+}

Reply via email to