Skip to content

ports/unix: Allow building with extmod/uselect rather than unix/uselect. - #6885

Closed
jimmo wants to merge 2 commits into
micropython:masterfrom
jimmo:unix-extmod-uselect
Closed

jimmo wants to merge 2 commits into
micropython:masterfrom
jimmo:unix-extmod-uselect

Conversation

@jimmo

@jimmo jimmo commented Feb 12, 2021

Copy link
Copy Markdown
Member

The unix implementation of uselect only works with file descriptors (i.e. cannot work on user-defined streams).

This PR allows the unix port to be built with the implementation of uselect that we use on bare-metal ports (which does allow this).

@stinos

stinos commented Feb 12, 2021

Copy link
Copy Markdown
Contributor

The unix implementation of uselect only works with file descriptors (i.e. cannot work on user-defined streams).

And the extmod implementation does not work for file descriptors I guess?

Perhaps add a check that only one of the implementations gets selected, just to avoid linker errors?

Comment thread ports/unix/mpconfigport.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm wondering why this is needed. py/objmodule.c already includes this module when MICROPY_PY_USELECT is enabled. Isn't that enough?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, you're right. Reverted.

@jimmo
jimmo force-pushed the unix-extmod-uselect branch from 84111fe to f8d616e Compare February 15, 2021 05:20
@jimmo

jimmo commented Feb 15, 2021

Copy link
Copy Markdown
Member Author

And the extmod implementation does not work for file descriptors I guess?

That's right. It's relatively straightforward to add MP_STREAM_POLL to unix/modusocket.c and extmod/vfs_posix_file.c if this is important in the future.

Perhaps add a check that only one of the implementations gets selected, just to avoid linker errors?

Good thinking. Done

@dpgeorge

Copy link
Copy Markdown
Member

Merged in fce0bd1 and 4c54012

@dpgeorge dpgeorge closed this Feb 16, 2021
Wind-stormger pushed a commit to BPI-STEAM/micropython that referenced this pull request Sep 15, 2022
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.

3 participants