Module Name: src
Committed By: pooka
Date: Tue May 26 15:29:39 UTC 2015
Modified Files:
src/sys/rump/librump/rumpkern: cons.c
Log Message:
Implement fo_poll so that rump_sys_poll(stdout) works
more or less as expected.
from Martin Lucina <[email protected]> via rumpkernel-users
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/librump/rumpkern/cons.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/librump/rumpkern/cons.c
diff -u src/sys/rump/librump/rumpkern/cons.c:1.4 src/sys/rump/librump/rumpkern/cons.c:1.5
--- src/sys/rump/librump/rumpkern/cons.c:1.4 Mon Aug 25 14:58:48 2014
+++ src/sys/rump/librump/rumpkern/cons.c Tue May 26 15:29:39 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: cons.c,v 1.4 2014/08/25 14:58:48 pooka Exp $ */
+/* $NetBSD: cons.c,v 1.5 2015/05/26 15:29:39 pooka Exp $ */
/*
* Copyright (c) 2013 Antti Kantee. All Rights Reserved.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.4 2014/08/25 14:58:48 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.5 2015/05/26 15:29:39 pooka Exp $");
#include <sys/param.h>
#include <sys/file.h>
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.4
#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 *,
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 st
return 0;
}
+
+static int
+rumpcons_poll(struct file *fp, int events)
+{
+ int revents = 0;
+
+ if (events & (POLLOUT | POLLWRNORM))
+ revents |= events & (POLLOUT | POLLWRNORM);
+
+ return revents;
+}