driver/pipe: add nonblock open support

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2021-08-13 20:54:11 +08:00 committed by Xiang Xiao
parent 11ed9199c1
commit ee3980abd7
1 changed files with 2 additions and 1 deletions

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 */
{