-
Notifications
You must be signed in to change notification settings - Fork 21
Port vsock-rs to use rustix #60
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
base: master
Are you sure you want to change the base?
Conversation
|
Avoiding unsafe code is nice, but I don't think we should be avoiding going through libc. In particular on Android, where we use this crate in several parts of the platform, there are a number of places where libc has important platform logic (e.g. for tracking file descriptors) that shouldn't be skipped, and so we would like to avoid using If there are some more safe wrappers in |
If this still worries you, the |
|
Unfortunately as of bytecodealliance/rustix#1528 rustix uses |
|
|
|
Actually, my understanding of the above PR is that it isn't making Android use the raw system call backend. Even if |
8ee606f to
ebc06ab
Compare
vsock-rs currently uses a mix of nix and libc to handle the underlying system calls. However, in addition to adding a few extra dependencies, this means that there is a significant amount of unneeded unsafe code in the project. By porting to "rustix", we gain the following advantages: - Most of the code in the project can be rewritten completely safely. - We avoid going through libc. In other projects this has been benchmarked to lead to a 2.5% performance increase. - On Linux, we reduce the number of dependencies the project pulls in. On other platforms, it stays the same. Blocked on bytecodealliance/rustix#1558 Signed-off-by: John Nunley <[email protected]>
ebc06ab to
1e90f22
Compare
vsock-rs currently uses a mix of nix and libc to handle
the underlying system calls. However, in addition to adding
a few extra dependencies, this means that there is a significant
amount of unneeded unsafe code in the project.
By porting to "rustix", we gain the following advantages:
safely.
benchmarked to lead to a 2.5% performance increase.
pulls in. On other platforms, it stays the same.
This is a breaking change, since this crate exposes primitives from nix; specifically "VsockAddr". I've added a new "SocketAddr" type that exposes no types from any subcrates.
Blocked on bytecodealliance/rustix#1558