Skip to content

Commit 8ee606f

Browse files
committed
Port vsock-rs to use rustix
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]>
1 parent 10ec085 commit 8ee606f

File tree

2 files changed

+174
-208
lines changed

2 files changed

+174
-208
lines changed

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ edition = "2021"
1111
exclude = ["test_fixture"]
1212

1313
[dependencies]
14-
libc = "0.2.158"
15-
nix = { version = "0.30.1", features = ["ioctl", "socket"] }
14+
rustix = { git = "https://github.com/forkgull/rustix", branch = "notgull/vsock", default-features = false, features = ["std", "net"] }
1615

1716
[dev-dependencies]
1817
rand = "0.9.0"

0 commit comments

Comments
 (0)