MCPcopy Index your code
hub / github.com/RustPython/RustPython / if_nametoindex

Function if_nametoindex

crates/stdlib/src/socket.rs:3084–3094  ·  view source on GitHub ↗
(name: FsPath, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

3082 #[cfg(not(target_os = "redox"))]
3083 #[pyfunction]
3084 fn if_nametoindex(name: FsPath, vm: &VirtualMachine) -> PyResult<IfIndex> {
3085 let name = name.to_cstring(vm)?;
3086 // in case 'if_nametoindex' does not set errno
3087 crate::common::os::set_errno(libc::ENODEV);
3088 let ret = unsafe { c::if_nametoindex(name.as_ptr() as _) };
3089 if ret == 0 {
3090 Err(vm.new_last_errno_error())
3091 } else {
3092 Ok(ret)
3093 }
3094 }
3095
3096 #[cfg(not(target_os = "redox"))]
3097 #[pyfunction]

Callers 1

extract_addressMethod · 0.85

Calls 5

new_last_errno_errorMethod · 0.80
set_errnoFunction · 0.50
ErrClass · 0.50
to_cstringMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected