LibBSD | rtemsbsd/libio: Give a duplicated descriptor an identity of its own (!153)
Chris Johns (@chris)
gitlab at rtems.org
Thu Jul 30 04:32:02 UTC 2026
Merge request https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/153 was reviewed by Chris Johns
--
Chris Johns started a new discussion on rtemsbsd/rtems/rtems-bsd-syscall-api.c: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/153#note_155888
> + oiop = rtems_bsd_libio_loc_to_iop(&iop->pathinfo);
> + if (oiop == NULL || oiop == iop || oiop < rtems_libio_iops ||
> + oiop >= &rtems_libio_iops[rtems_libio_number_iops]) {
Should the range check on the `iop` be moved into `rtems_bsd_libio_loc_to_iop()` and `NULL` returned if out of range? If the check is valid here should it be valid in all cases?
--
Chris Johns started a new discussion on testsuite/pipe01/test_main.c: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/153#note_155889
> +
> + errno = 0;
> + rv = pipe2(fd, 0x40000000);
How did you arrive at `0x40000000`? What flag does this map to?
--
Chris Johns started a new discussion on rtemsbsd/rtems/rtems-bsd-syscall-api.c: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/153#note_155890
> +static int rtems_bsd_pipe(int fildes[2], int flags);
> +int pipe(int fildes[2]);
> +int pipe2(int fildes[2], int flags);
This silently override the call in [rtos/rtems/pipe.c](https://gitlab.rtems.org/rtems/rtos/rtems/-/blob/main/cpukit/libfs/src/pipe/pipe.c). I suspect they are compatible so existing code bring linked against this version should be fine but it seems a bit fragile to rely on the linker picking this one up?
@joel do you have any suggestions on how this may be solved?
--
Chris Johns started a new discussion on rtemsbsd/rtems/rtems-bsd-syscall-api.c: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/153#note_155891
> +{
> + return rtems_bsd_pipe(fildes, flags);
> +}
As stated above I am not sure if this is stable enough?
--
Chris Johns started a new discussion on freebsd/sys/kern/kern_descrip.c: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/153#note_155892
> +#ifdef __rtems__
> +#include <machine/rtems-bsd-libio.h>
> +#endif /* __rtems__ */
Is the RTEMS guard needed here? There is an RTEMS header before this that is not included so is that wrong?
--
Chris Johns started a new discussion on freebsd/sys/kern/sys_generic.c: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/153#note_155893
> +}
> +#endif /* __rtems__ */
> +
This is outside the RTEMS guard.
--
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/153
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/sent_notifications/4-5e8mljsika0fkvb1sksv5jrdl-k/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260730/2f5a22ec/attachment-0001.htm>
More information about the bugs
mailing list