Module: xenomai-forge
Branch: master
Commit: c880d416a556c413405c1797907441e4b8bb59d3
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=c880d416a556c413405c1797907441e4b8bb59d3

Author: Wolfgang Grandegger <w...@denx.de>
Date:   Mon Mar 26 09:21:51 2012 +0200

nucleus: fix poll EOF issue with xnpipe/rt_pipe

So far, the EOF event is not handled in the Linux poll function of the
xnpipe/rt_pipe service when the pipe is closed (via rt_pipde_delete).
This patch fixes the issue by setting POLLUP in the Linux poll function
when the pipe is broken. The subsequent reads will then fail with errno
EPIPE.

Signed-off-by: Wolfgang Grandegger <w...@denx.de>

---

 kernel/cobalt/nucleus/pipe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/cobalt/nucleus/pipe.c b/kernel/cobalt/nucleus/pipe.c
index 2252b55..8581cbf 100644
--- a/kernel/cobalt/nucleus/pipe.c
+++ b/kernel/cobalt/nucleus/pipe.c
@@ -1033,6 +1033,8 @@ static unsigned xnpipe_poll(struct file *file, poll_table 
*pt)
 
        if (testbits(state->status, XNPIPE_KERN_CONN))
                w_mask |= (POLLOUT | POLLWRNORM);
+       else
+               r_mask |= POLLHUP;
 
        if (!emptyq_p(&state->outq))
                r_mask |= (POLLIN | POLLRDNORM);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to