PERFORCE change 163779 for review

Zhao Shuai zhaoshuai at FreeBSD.org
Mon Jun 8 13:05:06 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=163779

Change 163779 by zhaoshuai at zhaoshuai on 2009/06/08 13:04:22

	add fifo_poll_f()

Affected files ...

.. //depot/projects/soc2009/fifo/sys/fs/fifofs/fifo_vnops.c#11 edit

Differences ...

==== //depot/projects/soc2009/fifo/sys/fs/fifofs/fifo_vnops.c#11 (text+ko) ====

@@ -43,6 +43,7 @@
 #include <sys/kernel.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
+#include <sys/poll.h>
 #include <sys/stat.h>
 #include <sys/unistd.h>
 #include <sys/vnode.h>
@@ -491,7 +492,15 @@
 static int 
 fifo_poll_f(struct file *fp, int events, struct ucred *cred, struct thread *td)
 {
+	struct fifoinfo *fip = fp->f_data;
+	int levents, revents = 0;
 
-	return (0);
+	levents = events & (POLLIN | POLLRDNORM);
+	if ((fp->f_flag & FREAD) && levents) 
+		revents |= generic_pipe_poll(fip->fi_rpipe, levents, cred, td);
+	levents = events & (POLLOUT | POLLWRNORM);
+	if ((fp->f_flag & FWRITE) && levents)
+		revents |= generic_pipe_poll(fip->fi_wpipe, levents, cred, td);
+	return (revents);
 }
 


More information about the p4-projects mailing list