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

Jan Kiszka jan.kiszka at siemens.com
Fri Aug 30 19:01:03 CEST 2019


On 30.08.19 18:04, Philippe Gerum wrote:
> 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();						\
>   	}								\
> 

Thanks, applied to next, queued for stable.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux



More information about the Xenomai mailing list