[PATCH 2/2] cobalt/pipe: unblock read()/write() on disconnect

Philippe Gerum rpm at xenomai.org
Fri Aug 30 18:04:18 CEST 2019


Threads waiting on read()/write() must be unblocked when the kernel
endpoint is disconnected. read() should return 0, write() receives
-EPIPE.

Signed-off-by: Philippe Gerum <rpm at xenomai.org>
---
 kernel/cobalt/pipe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/pipe.c b/kernel/cobalt/pipe.c
index 16e85125c..0c83095ba 100644
--- a/kernel/cobalt/pipe.c
+++ b/kernel/cobalt/pipe.c
@@ -132,7 +132,7 @@ static inline void xnpipe_dequeue_all(struct xnpipe_state *state, int mask)
 		if (__sigpending)					\
 			break;						\
 		prepare_to_wait_exclusive(__waitq, &__wait, TASK_INTERRUPTIBLE); \
-		if (__cond)						\
+		if (__cond || (__state)->status & XNPIPE_KERN_LCLOSE)	\
 			break;						\
 		schedule();						\
 	}								\
-- 
2.21.0




More information about the Xenomai mailing list