RTEMS | cpukit/libio: Support close with IOP references held (!516)

Chris Johns (@chris) gitlab at rtems.org
Wed Jun 25 04:32:08 UTC 2025




Chris Johns commented on a discussion on cpukit/libcsupport/src/libio.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/516#note_125256

 > +    /*
 > +     * Clear the flags. All references should have been dropped.
 > +     */
 > +    _Atomic_Store_uint( &iop->flags, LIBIO_FLAGS_FREE, ATOMIC_ORDER_RELAXED );
 >  
 > -  rtems_libio_lock();
 > +    rtems_filesystem_location_free( &iop->pathinfo );
 >  
 > -  /*
 > -   * Clear everything except the reference count part.  At this point in time
 > -   * there may be still some holders of this file descriptor.
 > -   */
 > -  rtems_libio_iop_flags_clear( iop, LIBIO_FLAGS_REFERENCE_INC - 1U );
 > -  zero = offsetof( rtems_libio_t, offset );
 > -  memset( (char *) iop + zero, 0, sizeof( *iop ) - zero );
 > +    rtems_libio_lock();

Re the race discussion with the flags what it the lock is held over the course of this function?

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/516#note_125256
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250625/0f157a6a/attachment.htm>


More information about the bugs mailing list