polling icon indicating copy to clipboard operation
polling copied to clipboard

Add support for PS Vita

Open notgull opened this issue 2 years ago • 4 comments

Related: https://github.com/tokio-rs/mio/pull/1721

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

notgull avatar Oct 18 '23 15:10 notgull

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

nikarh avatar Oct 18 '23 19:10 nikarh

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

sunfishcode avatar Oct 19 '23 13:10 sunfishcode

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

notgull avatar Dec 11 '23 00:12 notgull

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

nikarh avatar Dec 13 '23 12:12 nikarh

Will attempt this one

mamaicode avatar Apr 16 '24 19:04 mamaicode

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

nikarh avatar Apr 16 '24 20:04 nikarh

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

mamaicode avatar Apr 16 '24 20:04 mamaicode

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?

notgull avatar Apr 16 '24 23:04 notgull

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.

nikarh avatar Apr 17 '24 07:04 nikarh