MCPcopy Index your code
hub / github.com/cloud-hypervisor/cloud-hypervisor / create_unix_socket

Function create_unix_socket

net_util/src/lib.rs:93–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91}
92
93fn 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
104fn vnet_hdr_len() -> usize {
105 std::mem::size_of::<virtio_net_hdr_v1>()

Callers 5

set_mac_addrMethod · 0.85
get_mac_addrMethod · 0.85
mtuMethod · 0.85
set_mtuMethod · 0.85
enableMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected