Closed nikarh closed 11 months ago
You'll still ignore it, but I'll leave this note here anyway: async pipes will break (without proper error) if network is in adhoc mode.
If this is only for Tokio, maybe it's better to implement kqueue/epoll instead?
You'll still ignore it, but I'll leave this note here anyway: async pipes will break (without proper error) if network is in adhoc mode.
you
? (nikarh or me?)
- who is
you
? (nikarh or me?)
You
- so does @sleirsgoevy 's mention(implement with epoll) be better option to prevent an issue of the adhoc mode?
Obviously not. 1) You can't have tcp sockets in adhoc mode 2) select/poll is implemented through epoll
why do you think i ignore you. but nvm i dont want meanless conversation in here. if you want please send message in discord or email.
well, you right. our select and poll uses epoll and currently it's limitated with socket.
idk sceIoOpen with SCE_O_NOWAIT
is callable and can it work with epoll. hm
idk sceIoOpen with
SCE_O_NOWAIT
is callable and can it work with epoll. hm
no. sceIoOpen also isn't relevant. MsgPipes can be async. It just requires additional work to multiplex them with sockets in poll/select
hey isage. do you have any idea or suggestions? or just share the side effects?
Yes. Use async MsgPipes
Yes. Use async MsgPipes
yep you make sense.
I'll add the FIXME tag of it.
The reason I did not go with MsgPipes is that they would require a clever reimplementation of epoll
/select
, and the only solution I can think of would be a spin loop doing syscalls to check pipe state for each pipe fds, and a netEpoll call that instantly returns for all net fds. And I don't know how justified syscalls in a spin loop are for pipes in terms of performance.
As for ad-hoc mode - I never tested it with ad-hoc, but at least opening a socket on loopback works with wifi disabled and in airplane mode.
Motivation:
In Rust ecosystem many libraries rely on a
tokio
async runtime, which internally requires nonblocking unix pipes (as a fallback for os'es without epoll or kqueue).This PR contains:
socketpair
call. This just creates a IPV4 socket pair yolo ignoring the domain passed as an argument since usuallysocketpair
is used withAF_UNIX
, and they are not supportedpipe2
call for nonblocking unix pipes. Depending on the options it delegates either to the originalpipe
or tosockerpair
call. This allows havingselect
,poll
,read
,write
calls for nonblocking pipes without any additional code, because pipe in that case is just a pair of sockets.fcntl
is not implemented, since I don't want to touch/break the originalpipe
implementation in case blocking pipes are needed.read
andwrite
calls for pipes, previously they returned buffer length instead of actually read bytes length