Hi NuttXers!

I've just submitted a proposal for making NuttX's pipe (FIFO)
POSIX-compliant regarding `open` for write-only when there are no readers.

Nowadays, opening a FIFO for write-only (with O_NONBLOCK cleared) won't
block even if there are no readers. Only opening for read-only (with no
writers) would block. This is not a POSIX-compliant behavior.

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.
>
>
It would be a *possible* breaking change if any application was written
specifically to expect an `open` for write-only (and `O_NONBLOCK` cleared,
of course) to be non-blocking even if there are no readers. Being able to
port POSIX-compliant applications that expect `open` to block when opening
for write-only with no readers would enhance NuttX's objective of "to
achieve a high degree of standards compliance. The primary governing
standards are POSIX and ANSI standards". That is the case for [RTP Tools](
https://github.com/apache/nuttx-apps/pull/1651), for instance.

So, please consider the following changes on PRs:

   1. https://github.com/apache/nuttx/pull/8985
   2. https://github.com/apache/nuttx-apps/pull/1707

Let me know if you think it isn't advisable to accept the proposed changes!

Best regards,


--
Tiago Medicci Serrano

Embedded Software Engineer
MSc Electronics/Microelectronics
m: +55 (19) 981403886 <+55+(19)+981403886>
e: tiago.medi...@gmail.com
a: Campinas, Brazil
Follow me:
<https://www.linkedin.com/in/tiago-serrano-924458b6>
<https://github.com/tmedicci>

Reply via email to