RTEMS5 File Descriptors
Matthew J Fletcher
amimjf at gmail.com
Wed Nov 21 06:51:27 UTC 2018
Hi,
We had a similar issue, I believe FD_SETSIZE is only defined to 64 if it's
not already defined by the application, see (select.h), you would probably
have to pass -DFD_SETSIZE=500 from the complier command line though as you
would need to set the definition really early before most includes.
On Wed, 21 Nov 2018, 04:21 Ian Caddy <ianc at goanna.iinet.net.au wrote:
> Hi All,
>
> We are in the process of porting an existing application from RTEMS4.10
> to RTEMS5, and have an issue with "select".
>
> We have previously known of the issue which also exists in RTEMS 4.10,
> but the problem is exacerbated in RTEMS5 due to the change in the way
> the libio descriptors are allocated.
>
> First some history. With RTEMS and newlib and "select" this only works
> for the first 64 file descriptors as the fd_set size is set in newlib,
> by default to a size of 64. Therefore you can not use the select call
> is your file descriptor is greater than 64 (on RTEMS 4.10 we got around
> this by creating our own select with our own fd_set), but on RTEMS 5 we
> have also moved to libbsd with a brand new select and underlying
> implementation.
>
> We also open quite a lot of files at particular times, so our
> CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS is set to 500. These files are
> open at a different time to using the select, and so they lived together
> OK.
>
> With RTEMS 4.10 the libio would allocate off the list and once freed
> they would be returned to the free list. The opens would allocate from
> the start of the list, so mostly the fd's were low numbers (under 64).
>
> With RTEMS 5, this has changed so when freed the descriptors are now put
> at the end of the free list, which means we will use all the libio
> allocators before wrapping around into which ever order they were freed
> previously.
>
> This means our select is currently pretty much guaranteed going over the
> default 64 fd_set limit at some stage (currently it is happening right
> at the beginning.... for now on my simple system I have changed our
> MAX_FILE_DESCRIPTORS to 64 and the select is working OK.
>
> Does anyone know of a nice way around this issue without saying don't
> use select.... ;-)
>
> regards,
>
> Ian Caddy
>
>
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20181121/20b93991/attachment-0002.html>
More information about the users
mailing list