RTEMS | cpukit/libio: Support close with IOP references held (!516)
Chris Johns (@chris)
gitlab at rtems.org
Wed Jun 25 04:39:02 UTC 2025
Chris Johns commented on a discussion on cpukit/include/rtems/libio_.h: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/516#note_125257
> - * flags and error.
> + * @brief Function to get the iop for the specified file descriptor
> + * with access flags and error.
> *
> * Checks that the file descriptor is in the valid range and open.
> */
> +static inline int rtems_libio_get_iop_with_access(
> + int fd, rtems_libio_t **iop, unsigned int access_flags, int access_error
> +)
> +{
> + if ( (uint32_t) ( fd ) >= rtems_libio_number_iops ) {
> + return EBADF;
> + }
> + *iop = rtems_libio_iop( fd );
> + const unsigned int flags = rtems_libio_iop_hold( *iop );
> + const unsigned int mandatory = LIBIO_FLAGS_OPEN | access_flags ;
Yes, too much C++. We do loose the `const` bit :grinning:
I have also set `*iop` to `NULL` on error in case a use does not check the result returned.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/516#note_125257
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/aa495d88/attachment-0001.htm>
More information about the bugs
mailing list