Skip to content

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

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

Closed
wants to merge 2 commits into from

Conversation

jimmo
Copy link
Member

@jimmo jimmo commented Feb 12, 2021

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
Copy link
Contributor

stinos commented Feb 12, 2021

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?

@@ -235,7 +235,7 @@ extern const struct _mp_obj_module_t mp_module_jni;
#else
#define MICROPY_PY_SOCKET_DEF
#endif
#if MICROPY_PY_USELECT_POSIX
#if MICROPY_PY_USELECT_POSIX || MICROPY_PY_USELECT
Copy link
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
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.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
@jimmo jimmo force-pushed the unix-extmod-uselect branch from 84111fe to f8d616e Compare February 15, 2021 05:20
@jimmo
Copy link
Member Author

jimmo commented Feb 15, 2021

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
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