RSoC: Porting tokio to redox - week 3

By jD91mZM2 on

Porting tokio, update 3

We’re back! Last week I ended off stating that the redox netstack might soon switch to an edge-triggered model. Well, I ended up feeling bad about the idea of letting others do my work and decided to stop being lazy and just do it myself :)
PR to netstack
This change allowed me to get rid of 82 (mostly repeated) lines of tokio workarounds (diff)! Applications that don’t immediately handle read/write events should now be more efficient since the selector is now blocking instead of returning any existing event over and over.

This was the start towards the goal of making everything edge-triggered. I was bored and decided to rewrite telnetd to use tokio, when I discovered that PTYs were not yet edge-triggered.
PR to ptyd
(This broke userutils and orbterm, which I fixed :))


SamwiseFilmore did some efforts towards testing thrussh! He wrote a recipe for libsodium, ported cryptovec, and made a fork of thrussh with all dependencies updated to use their respective redox forks. I sent off a PR to fix compilation errors with the latest tokio, and patched libsodium.
The thrussh example I tried was buggy and only worked 1% of the time even on linux. But once, I managed to get this: Screenshot of thrussh client on redox
Screenshot of thrussh server on linux

Unix sockets

I was going to see if I could make unix sockets edge-triggered, but redox didn’t have unix sockets. So I created an alternative (following an existing RFC) ;) Mostly because creating a scheme from scratch was really fun and exciting! It feels so magical to then actually use it! Seriously, I ended up spending a looong time on tests just because it felt so unreal that they actually passed. I love redox schemes <3

More stuff…

Being bored again I asked for more tasks and was told to make orbital and vesad edge-triggered as well. So I did:

This somewhat broke orbclient when making too fast movements, which I fixed.

I was also recommended to update smoltcp version in netstack, but I got a weird issue with https. I think this is upstream’s fault, see m-labs/smoltcp#226.


The amount of links in this blog makes it look like I did a lot of work this week. Truth is, this week was actually really fun! First week was more frustrating because most time was spent tracking down issues, but this week it was all about fixing them :)

Upstreaming this project is going really slowly. We FINALLY got libc bumped and socket2-rs merged. … Eeeeexcept I accidentally broke socket2-rs, and the fix is not yet merged.

What’s next? No idea! Currently I’m thinking about making rust’s UnixStream and UnixListener work with ipcd, and slowly try to get tokio-uds working. But that’s long-term and probably won’t happen any time soon.