()
| 91 | } |
| 92 | |
| 93 | fn create_unix_socket() -> Result<net::UdpSocket> { |
| 94 | // SAFETY: we check the return value. |
| 95 | let sock = unsafe { libc::socket(libc::AF_UNIX, libc::SOCK_DGRAM, 0) }; |
| 96 | if sock < 0 { |
| 97 | return Err(Error::CreateSocket(IoError::last_os_error())); |
| 98 | } |
| 99 | |
| 100 | // SAFETY: nothing else will use or hold onto the raw sock fd. |
| 101 | Ok(unsafe { net::UdpSocket::from_raw_fd(sock) }) |
| 102 | } |
| 103 | |
| 104 | fn vnet_hdr_len() -> usize { |
| 105 | std::mem::size_of::<virtio_net_hdr_v1>() |
no outgoing calls
no test coverage detected