LibBSD | dup() and fcntl(F_DUPFD) fail with ENXIO for libbsd descriptors (#101)

Chris Johns (@chris) gitlab at rtems.org
Wed Jul 29 02:41:49 UTC 2026




Chris Johns commented: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/work_items/101#note_155744


LibBSD lacks support for `fcntl(.*)` and `libcsupport` uses that call to implement `dup()` and `dup2()`. You can see limit set of cases supported in [rtems_bsd_sysgen_fcntl()](https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/blob/7-freebsd-14/rtemsbsd/rtems/rtems-bsd-syscall-api.c?ref_type=heads#L1514).

And I think the default case is wrong and an error should be returned. The Open Group's [fcnlt()](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html) seems to indicate this?

I think the place to start looking into this a test for the testsuite. Is this something you could do? It would be nice to have a test case that captures the EPICS use case.

---

**_Note_**: we have stopped support for `6-freebsd-12`. The branch is over 50,000 commits behind `6-freebsd-14` and `7-freebsd-14`. If we resolve things on `7-freebsd-14` we can back port the fixes to `6-freebsd-14`.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/work_items/101#note_155744
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/sent_notifications/4-a1xru4b2gd81ef18kw5x0byvg-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/20260729/34b494f8/attachment.htm>


More information about the bugs mailing list