Skip to content

Conversation

@notgull
Copy link
Contributor

@notgull notgull commented Dec 21, 2025

This is necessary in order to connect to AF_VSOCK sockets, or listen
on the AF_VSOCK socket type.

Dependent on sunfishcode/linux-raw-sys#177

@notgull notgull marked this pull request as ready for review December 23, 2025 04:21
@notgull notgull force-pushed the notgull/vsock branch 2 times, most recently from 366e85c to 536f911 Compare December 23, 2025 04:48
notgull added a commit to forkgull/vsock-rs that referenced this pull request Dec 23, 2025
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 <dev@notgull.net>
@notgull notgull force-pushed the notgull/vsock branch 6 times, most recently from d1b97ab to 8b0c58b Compare December 23, 2025 06:20
This is necessary in order to connect to AF_VSOCK sockets, or listen
on the AF_VSOCK socket type.

Signed-off-by: John Nunley <dev@notgull.net>
@notgull
Copy link
Contributor Author

notgull commented Dec 23, 2025

No, I don't know why this * 8 is necessary. "addr_len" keeps returning 16 when the real address length is 128. Maybe some kind of weird endianness issue.

notgull added a commit to forkgull/vsock-rs that referenced this pull request Dec 24, 2025
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 <dev@notgull.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant