Hi Kikichi-san,

In the past NuttX used to have a config to define the max number of
file descriptors/file streams. Now it is allocated dynamically.

I think the max number of FDs should be board and application dependent.

So, maybe in this case is better to start with a smaller "reasonable"
amount of file and let users to increase it.

That said, I think to be able to support more boards (without
crashing) and still have a reasonable number of FDs, I would start
with 128.

BR,

Alan

On 2/16/23, KIKUCHI Takeyoshi <kiku...@centurysys.co.jp> wrote:
> currently porting the Nim language to NuttX.
> (It has been merged into the Nim devel branch)
>
> When using select/epoll, it is necessary to determine the maximum value
> of file descriptor in order to assign a structure to store the fd to be
> waited in advance.
>
> It is used in this way.
>
> ---------
> proc newSelector*[T](): Selector[T] =
>    # Retrieve the maximum fd count (for current OS) via getrlimit()
>    var maxFD = maxDescriptors() <---
> # Start with a reasonable size, checkFd() will grow this on demand
>    const numFD = 1024
> ...
> for i in 0 ... < numFD:
>      result.fds[i].ident = InvalidIdent
> ---------
> (Now I realize that numFD also needs to be switched for NuttX...)
>
> Since the available memory capacity varies from device to device,
> Is there any way to find the best value for each build config?
>
> Porting to FreeRTOS in the Nim language uses the maximum number of
> sockets available, set by the user at build time.
>
> ---------
> var FD_MAX* {.importc: "CONFIG_LWIP_MAX_SOCKETS", header:
> "<lwipopts.h>".} : cint
> ---------
>
> best regards,
> KIKUCHI Takeyoshi
>
> ---
> kiku...@centurysys.co.jp
>

Reply via email to