You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/08/20 02:18:57 UTC
[incubator-nuttx] 01/02: driver/pipe: add nonblock open support
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit ee3980abd7b2a331a207e05299df7a24df3be571
Author: chao.an <an...@xiaomi.com>
AuthorDate: Fri Aug 13 20:54:11 2021 +0800
driver/pipe: add nonblock open support
Signed-off-by: chao.an <an...@xiaomi.com>
---
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 991c89a..28f218b 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 */
{