yangsong8-a1 opened a new pull request, #21592:
URL: https://github.com/apache/nuttx/pull/21592

   ## Summary
   Protect the pipe buffer with a recursive spinlock instead of the rmutex,
   so a signal delivered to a writer no longer breaks the lock. Buffers are
   allocated and freed with the pipe unlocked: circbuf_reinit() swaps in a
   buffer allocated by the caller, and PIPEIOC_SETSIZE uses it.
   
   The series also adds pipecommon_writev(). By default a writev is a byte
   stream as before; PIPEIOC_ATOMICWRITE makes a request land in full or
   fail with -EMSGSIZE if it can never fit, so a reader never sees half of
   a message written in chunks.
   
   - spinlock.h: add rspin_lock_is_locked() and friends, used by the pipe
     code
   - libc/misc/circbuf: add circbuf_reinit()
   - drivers/pipes: rmutex to rspinlock, PIPEIOC_SETSIZE return value fix,
     pipecommon_writev()
   
   ## Impact
   Pipes and FIFOs. New ioctl PIPEIOC_ATOMICWRITE; the default behavior of
   write()/writev() is unchanged.
   
   ## Testing
   Ubuntu 22.04, gcc 13.1, sim:nsh with CONFIG_PIPES. A test program
   resizes a pipe, enables atomic mode, then one thread writes 2000
   length-prefixed messages with writev() while the main thread reads them
   back; it also writes and reads a FIFO:
   ```
   pipe: SETSIZE(256) ret=0, GETSIZE=256
   pipe: ATOMICWRITE(1) ret=0
   pipe: atomic writev larger than buffer ret=-1 errno=90
   pipe: 2000 writev messages read, broken: 0
   fifo: open rd=3 wr=4
   fifo: write ret=10 errno=0
   fifo: read ret=10 data=hello fifo
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] drivers/pipes: replace r... yangsong8-a1 (via GitHub) via commits

Reply via email to