(name: FsPath, vm: &VirtualMachine)
| 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] |
no test coverage detected