Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[WIP] bpo-28708: Add setsize keywoard-only parameter to select.select()#13845

Closed
vstinner wants to merge 1 commit into
python:masterpython/cpython:masterfrom
vstinner:select_setsizeCopy head branch name to clipboard
Closed

[WIP] bpo-28708: Add setsize keywoard-only parameter to select.select()#13845
vstinner wants to merge 1 commit into
python:masterpython/cpython:masterfrom
vstinner:select_setsizeCopy head branch name to clipboard

Conversation

@vstinner

@vstinner vstinner commented Jun 5, 2019

Copy link
Copy Markdown
Member

It becomes possible to configure the set size used internally by
select.select() at runtime.

https://bugs.python.org/issue28708

It becomes possible to configure the set size used internally by
select.select() at runtime.
@vstinner

vstinner commented Jun 5, 2019

Copy link
Copy Markdown
Member Author

I have no idea if this PR works :-) Is it really possible to change FD_SETSIZE at runtime?

Comment thread Modules/selectmodule.c
pylist efd2obj[FD_SETSIZE + 1];
#endif /* SELECT_USES_HEAP */
PyObject *ret = NULL;
fd_set ifdset, ofdset, efdset;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these three sets will need to be allocated differently. We'll probably need a different fd_set structure something like:

typedef struct fd_set_2
{
    u_int fd_count
    SOCKET *fd_array;
} fd_set_2;

and then dynamically allocate the fd_array to be a SOCKET* array of size set_size.
Knowing that the select implementation only looks at the fd_count for the size of the array (and doesn't do any boundary checking), we can cast those sets to fd_set and then pass them to the select call.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually that struct type isn't going to work, because that adds a level of indirection that the select implementation doesn't expect.
We'll need to allocate a continuous area of memory of size (sizeof(u_int) + setsize*sizeof(SOCKET))

@vstinner

Copy link
Copy Markdown
Member Author

It seems like @andzn went further than me in PR #13842, I close my WIP PR.

@vstinner vstinner closed this Jun 14, 2019
@vstinner vstinner deleted the select_setsize branch June 14, 2019 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.