netstack: round 18 part 3 — fix SocketCall::from misuse (last compile error)

scheme/tcp.rs:57 — SocketCall::from(metadata[0]) does not exist.
SocketCall in the libredox-protocol crate exposes a
'try_from_raw(usize) -> Option<Self>' helper (used in
scheme/socket.rs:466) but no 'From<u64>'. Match on the Option
and return EINVAL on unknown verbs; otherwise the same
SocketCall::SendMsg arm as before and the catch-all
EOPNOTSUPP for any other verb.

This is the last of the 13 build errors from the original
netstack break cascade. After this commit, netstack compiles
clean with only 40 warnings (unused imports/variables and a
handful of unreachable-pattern arms left as dead-code
defenses). Warnings are tracked for a future cleanup round.
This commit is contained in:
2026-07-28 07:02:30 +09:00
parent 468ac36e97
commit 6860e49623
+5 -1
View File
@@ -54,7 +54,11 @@ impl<'a> SchemeSocket for TcpSocket<'a> {
metadata: &[u64],
_ctx: &CallerCtx,
) -> SyscallResult<usize> {
match SocketCall::from(metadata[0]) {
let verb = match SocketCall::try_from_raw(metadata[0] as usize) {
Some(v) => v,
None => return Err(SyscallError::new(syscall::EINVAL)),
};
match verb {
SocketCall::SendMsg => {
let flags = metadata[1] as u16;
// smoltcp's TCP socket has no MSG_NOSIGNAL awareness: a