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

Add support for PS Vita #160

Closed
notgull opened this issue Oct 18, 2023 · 9 comments · Fixed by #197
Closed

Add support for PS Vita #160

notgull opened this issue Oct 18, 2023 · 9 comments · Fixed by #197

Comments

@notgull
Copy link
Member

notgull commented Oct 18, 2023

Related: tokio-rs/mio#1721

This will probably need to be tacked onto the poll() backend like ESP-IDF is.

@nikarh
Copy link
Contributor

nikarh commented Oct 18, 2023

Hi, I will be glad to help with this target, although this will require porting rustix first

@sunfishcode
Copy link
Contributor

rustix 0.38.20 now compiles under armv7-sony-vita-newlibeabihf.

@notgull
Copy link
Member Author

notgull commented Dec 11, 2023

@nikarh You said you wanted to help for this target; any updates on this?

@nikarh
Copy link
Contributor

nikarh commented Dec 13, 2023

@nikarh You said you wanted to help for this target; any updates on this?

Hi, sorry for the delay. I haven't started working on it yet.
I'm vacating till Christmas, but after that, I'll have some free time and do it.

@mamaicode
Copy link

Will attempt this one

@nikarh
Copy link
Contributor

nikarh commented Apr 16, 2024

The last time I checked almost everything worked, except for the waker.
There was a problem here https://github.com/smol-rs/polling/blob/1c16a1e4affaecc9e1f149c5d00133624b268405/src/poll.rs#L225C40-L225C56

As far as I remember, this code assumes that if it writes to the pipe, the message becomes immediately available on the other side of the pipe (pop_notification does a read syscall on a NONBLOCK pipe).

On Vita message written to pipe is not immediately available for read after calling write on the other side of the pipe.

This is because Vita doesn't have a syscall that could poll both network sockets and pipes, so pipes in the Vita newlib are implemented (or more like mocked) as a net socket on a loopback, because this implementation is much simpler than reimplementing poll as a custom busy loop with multiple syscalls for different fd types.

TBH I am not sure how to solve this - we can either make pipes and poll more sensible in Vita newlib (a lot of work), or make some specific code branch for vita in this crate, which may not be something worth the maintenance burden

@mamaicode
Copy link

@nikarh Thank you for pointing it out before I got started!
Which decision do we go with? keep me posted

@notgull
Copy link
Member Author

notgull commented Apr 16, 2024

On Vita message written to pipe is not immediately available for read after calling write on the other side of the pipe.

Could this be solved by blocking on the read instead of using NONBLOCK?

@nikarh
Copy link
Contributor

nikarh commented Apr 17, 2024

On Vita message written to pipe is not immediately available for read after calling write on the other side of the pipe.

Could this be solved by blocking on the read instead of using NONBLOCK?

Yes, I made a PR with just that. With this PR all tests actually pass on Vita (except for many_connections due to severely limited max fd count on the platform, but changing 100 to something like 60 makes it pass)

@mamaicode Sorry for stealing this from you 🙏 I had this code stashed locally on my machine and wasn't sure about making a PR since the solution is kinda ugly.

notgull pushed a commit that referenced this issue Apr 20, 2024
@notgull notgull mentioned this issue Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants