[EXTERNAL] Re: select call on a UDP socket with BSD library?
Cudmore, Alan P. (GSFC-5820)
alan.p.cudmore at nasa.gov
Tue Sep 1 12:50:25 UTC 2020
The FD_SETSIZE limit was my problem. I defined FD_SETSIZE=256 on the command line and the select call worked.
On the SPARC/LEON3 with the legacy network stack, the file descriptor was 42 so it did not reach the limit of 64.
Thank you for the quick help and the documentation updates. I was unaware of the FD_SETSIZE parameter and was just adjusting the CONFIGURE_MAXIMUM_FILE_DESCRIPTORS parameter.
Chris: have been using the "ifconfig" command on my Beaglebone target, it is a nice tool to have.
I have also been examining the selectpollkqueue01 libbsd example. My next step this morning was to run that on the beaglebone before I got the pleasant surprise of having the solution waiting for me.
Thanks again,
Alan
On 9/1/20, 12:55 AM, "devel on behalf of Sebastian Huber" <devel-bounces at rtems.org on behalf of sebastian.huber at embedded-brains.de> wrote:
On 01/09/2020 05:31, Ian Caddy wrote:
>
> On 1/09/2020 10:48 am, Chris Johns wrote:
>> On 1/9/20 6:14 am, Cudmore, Alan P. (GSFC-5820) wrote:
>>> I am having problems using the “select” call with an RTEMS + LibBSD
>>> network socket.
>>>
>>> I’m trying to use “select” to check the socket (using a timeout of
>>> zero), but
>>> when I call select I get a -1 return code with EBADF errno.
>> I suspect you have hit the FD set size limit.
>>
>>> The fd in this instance is 77 and I have RTEMS setup for 200 file
>>> descriptors.
>>> Are there any other LibBSD configuration parameters I should be aware
>>> of?
>>> When I build a SPARC/LEON3 BSP with the RTEMS legacy network stack,
>>> the select
>>> call seems to work. Admittedly I am just doing this on the loopback
>>> interface on
>>> QEMU since I do not have a real or simulated ethernet device to use.
>>> But the
>>> select call seems to work as I would expect in this instance.
>> What is the fd for that stack? I suspect the fd is less than 64.
>
> I can confirm what Chris is saying and that the RTEMS4.10 stack has a FD
> setsize of 64 as well, but the old network stack gets the fd's from the
> bottom, so as long as you have less than 64 files and sockets open you
> will be OK.
>
> With LIBBSD, it seems much more random and even getting one of more
> sockets can get you over the default 64 limit, as you are seeing with
> the fd=77.
In RTEMS 5.1 the file descriptor list is a LIFO in contrast to previous
versions where it was a FIFO. This means if an application regularly
opens and closes files (or sockets) it sees the whole range of file
descriptors. The reason for this change was to increase the time before
file descriptors are reused to more likely catch a file descriptor use
after close.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________
devel mailing list
devel at rtems.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.rtems.org_mailman_listinfo_devel&d=DwIGaQ&c=ApwzowJNAKKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=mW-jVVDIxBn4bZU1jogCo9FDuDuPszsoVj1mqBvCXzw&m=5ZksMNgfCoMR_ilEWegBjlMxlz1P9hN8ocK-I4H1Dq4&s=sGLGUWYNRtvwE-uN8tSykKv_x42F0KCVQ6FCV334zhs&e=
More information about the devel
mailing list