From ee3980abd7b2a331a207e05299df7a24df3be571 Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Fri, 13 Aug 2021 20:54:11 +0800 Subject: [PATCH] driver/pipe: add nonblock open support Signed-off-by: chao.an --- drivers/pipes/pipe_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pipes/pipe_common.c b/drivers/pipes/pipe_common.c index 991c89af4e2..28f218b8688 100644 --- a/drivers/pipes/pipe_common.c +++ b/drivers/pipes/pipe_common.c @@ -243,7 +243,8 @@ int pipecommon_open(FAR struct file *filep) sched_lock(); nxsem_post(&dev->d_bfsem); - if ((filep->f_oflags & O_RDWR) == O_RDONLY && /* Read-only */ + if (!(filep->f_oflags & O_NONBLOCK) && /* Non-blocking */ + (filep->f_oflags & O_RDWR) == O_RDONLY && /* Read-only */ dev->d_nwriters < 1 && /* No writers on the pipe */ dev->d_wrndx == dev->d_rdndx) /* Buffer is empty */ {