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

Kinsey Moore (@opticron) gitlab at rtems.org
Sat Jun 21 02:44:47 UTC 2025



Merge request https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/516 was reviewed by Kinsey Moore

--
  
Kinsey Moore started a new discussion on cpukit/include/rtems/libio_.h: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/516#note_125037

 > + * ignore the request.
 > + */
 > +static inline void rtems_libio_free(

This might be better named as `rtems_libio_try_free` since the attempt is made with caveats. The description above helps with the understanding, but I will forget this nuance when reading it in the codebase any more than 2 weeks from now.

--
  
Kinsey Moore started a new discussion on cpukit/include/rtems/libio_.h: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/516#note_125038

 > +  const unsigned int flags = rtems_libio_iop_flags( iop );
 > +  if ( ( ( flags & LIBIO_FLAGS_OPEN ) == 0 )
 > +       && ( ( flags & LIBIO_FLAGS_REFERENCE_MASK ) == 0 ) ) {

This should use `rtems_libio_iop_is_free` and `rtems_libio_iop_is_held` since they're inlined and will likely optimize away the duplicated `rtems_libio_iop_flags` call anyway.

--
  
Kinsey Moore started a new discussion on cpukit/libcsupport/src/libio.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/516#note_125039

 > +    /*
 > +     * Clear the flags. All references should have been dropped. Free
 > +     * IOP have all reference count its set.

"reference count its" -> "reference count bits"?

Nothing here is checking that all ref count bits are set and the atomic store below would clear said bits.


-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/516
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/20250621/43f36b8f/attachment-0001.htm>


More information about the bugs mailing list