Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace select() with a call able to handle >1024 filedescriptors #278

Open
tabascoeye opened this issue Feb 4, 2022 · 2 comments
Open
Assignees

Comments

@tabascoeye
Copy link

tabascoeye commented Feb 4, 2022

In this line:

if (select((int)SELECT_FD(sock->fd), NULL, &fdset,
a posix select() call is used.
This is limited to handle a maxmium of 1024 filedescriptors in a system (overall, not only in that specific call!).

Depending on the system, this is not limited to sockets, but simple files as well.
If the select() is then called wth an fd where the id is above 1024, the behavior is undefined, in most cases it just fails.

==> please replace this by e.g. poll() or other more modern mechanism for the scheme

@embhorn embhorn self-assigned this Feb 4, 2022
@embhorn
Copy link
Member

embhorn commented Feb 4, 2022

Hello @tabascoeye

Thanks for your suggestion! I will treat this as a feature request. The example client code is designed to be easy to understand and helpful for someone getting started. I think this feature will support those goals.

Could you tell us a bit about your project? Does the 1024 fd limit from select() impact you?

@dgarske
Copy link
Contributor

dgarske commented Oct 12, 2022

Hi @tabascoeye ,

Thank you for the suggestion.

@embhorn , we have some examples for using poll vs select here: https://github.com/wolfSSL/wolfsentry/blob/naii_demo/examples/notification-demo/echo_server/echo.c#L530
https://github.com/wolfSSL/wolfsentry/blob/naii_demo/examples/notification-demo/echo_server/echo.c#L647

If you do add this support please make sure there is a build option to support either.

Thanks, David Garske, wolfSSL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants