thread1 thread2
open pipe open pipe
close()
-> pipecommon_close()
-> check inode refs
-> do NOT free dev close()
-> pipecommon_close()
-> check inode refs
-> do NOT free dev
-> inode_release
inode refs--
-> inode_release
inode refs--
Then, you will see the pipe hasn't free its resource, memleak
Resolve:
replace the inode refs with priv refs
Signed-off-by: ligd <liguiding1@xiaomi.com>
Both the device and the pipe used the FSNODEFLAG_TYPE_DRIVER type before,
and now add an independent pipe type
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
According to https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html
"
When opening a FIFO with O_RDONLY or O_WRONLY set:
* If O_NONBLOCK is set, an open() for reading-only shall return
without delay. An open() for writing-only shall return an error
if no process currently has the file open for reading.
* If O_NONBLOCK is clear, an open() for reading-only shall block
the calling thread until a thread opens the file for writing.
An open() for writing-only shall block the calling thread until
a thread opens the file for reading.
"
This commit has an equivalent on nuttx-apps: EXAMPLES_PIPE app
was updated to be able to check pipes and named pipes behavior.
arch/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
sched/ audio/ crypto/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
Documentation/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
fs/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
graphics/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
net/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
drivers/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
include/, syscall/, wireless/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
configs/: Remove all references to CONFIG_DISABLE_POLL. Standard POSIX poll can no longer be disabled.