<div dir="auto"><div>Hi,<div dir="auto"><br></div><div dir="auto">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.</div><br><br><div class="gmail_quote"><div dir="ltr">On Wed, 21 Nov 2018, 04:21 Ian Caddy <<a href="mailto:ianc@goanna.iinet.net.au" target="_blank" rel="noreferrer">ianc@goanna.iinet.net.au</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,<br>
<br>
We are in the process of porting an existing application from RTEMS4.10 <br>
to RTEMS5, and have an issue with "select".<br>
<br>
We have previously known of the issue which also exists in RTEMS 4.10, <br>
but the problem is exacerbated in RTEMS5 due to the change in the way <br>
the libio descriptors are allocated.<br>
<br>
First some history. With RTEMS and newlib and "select" this only works <br>
for the first 64 file descriptors as the fd_set size is set in newlib, <br>
by default to a size of 64. Therefore you can not use the select call <br>
is your file descriptor is greater than 64 (on RTEMS 4.10 we got around <br>
this by creating our own select with our own fd_set), but on RTEMS 5 we <br>
have also moved to libbsd with a brand new select and underlying <br>
implementation.<br>
<br>
We also open quite a lot of files at particular times, so our <br>
CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS is set to 500. These files are <br>
open at a different time to using the select, and so they lived together OK.<br>
<br>
With RTEMS 4.10 the libio would allocate off the list and once freed <br>
they would be returned to the free list. The opens would allocate from <br>
the start of the list, so mostly the fd's were low numbers (under 64).<br>
<br>
With RTEMS 5, this has changed so when freed the descriptors are now put <br>
at the end of the free list, which means we will use all the libio <br>
allocators before wrapping around into which ever order they were freed <br>
previously.<br>
<br>
This means our select is currently pretty much guaranteed going over the <br>
default 64 fd_set limit at some stage (currently it is happening right <br>
at the beginning.... for now on my simple system I have changed our <br>
MAX_FILE_DESCRIPTORS to 64 and the select is working OK.<br>
<br>
Does anyone know of a nice way around this issue without saying don't <br>
use select.... ;-)<br>
<br>
regards,<br>
<br>
Ian Caddy<br>
<br>
<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@rtems.org" rel="noreferrer noreferrer" target="_blank">users@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a></blockquote></div></div></div>