driver/pipe: add nonblock open support

Change-Id: Ibdf627167b1a30e698607b4f32f6b1c8cc2f15ae
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an
2021-08-13 20:54:11 +08:00
parent 2d597f55df
commit 00b373112b
+2 -1
View File
@@ -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 */
{