RTEMS5 File Descriptors

Ian Caddy ianc at goanna.iinet.net.au
Wed Nov 21 08:13:33 UTC 2018


Hi Mathew and Sebastian,

Thanks for the ideas.

On the older product there was a reasonable existing code base already 
built, so we effectively forced the users by deprecating the old select 
and made them build with the new select.

This is a new product with RTEMS 5 and since I am doing all the early 
work, I can force a compiler build option with the -DFD_SETSIZE=500so 
this is probably the direction we will go, that way all the users will 
end up with this define when they build their apps.

regards,

Ian Caddy


On 21/11/2018 3:00 pm, Sebastian Huber wrote:
> Hello Ian,
>
> the file descriptors use now reference counting. In case you use a 
> closed file descriptor you get an error. The file descriptor list 
> order was changed to keep closed file descriptors as long as possible 
> in the closed state to improve the detection of a use after close.
>
> In case you plan to switch to libbsd for networking, then using 
> kqueue() instead of select() is an option.
>
> A quick and dirty hack would be to patch Newlib and set FD_SETSIZE to 
> your desired value.
>
> If you have all your software under control, then you can also define 
> FD_SETSIZE yourself BEFORE you include <sys/select.h>.
>
> You can also dynamically allocate the fd_set depending on 
> rtems_libio_number_iops, for example:
>
> https://git.rtems.org/rtems-libbsd/commit/?id=4d8f9e62615d86a4f2d9b438da8276988277602f 
>
> https://git.rtems.org/rtems-libbsd/commit/?id=8ee0aa19cfc228a962d084bee805cb20bcd70f3b 
>
> https://git.rtems.org/rtems-libbsd/commit/?id=7ec4d8760dd98e647977fae76749609a81bdf6d2 
>
>
> I think we should mention this in the release notes.
>



More information about the users mailing list