(fd: i32, vm: &VirtualMachine)
| 171 | |
| 172 | #[pyfunction] |
| 173 | fn tcgetattr(fd: i32, vm: &VirtualMachine) -> PyResult<Vec<PyObjectRef>> { |
| 174 | let termios = Termios::from_fd(fd).map_err(|e| termios_error(e, vm))?; |
| 175 | let noncanon = (termios.c_lflag & termios::ICANON) == 0; |
| 176 | let cc = termios |
| 177 | .c_cc |
| 178 | .iter() |
| 179 | .enumerate() |
| 180 | .map(|(i, &c)| match i { |
| 181 | termios::VMIN | termios::VTIME if noncanon => vm.ctx.new_int(c).into(), |
| 182 | _ => vm.ctx.new_bytes(vec![c as _]).into(), |
| 183 | }) |
| 184 | .collect::<Vec<_>>(); |
| 185 | let out = vec![ |
| 186 | termios.c_iflag.to_pyobject(vm), |
| 187 | termios.c_oflag.to_pyobject(vm), |
| 188 | termios.c_cflag.to_pyobject(vm), |
| 189 | termios.c_lflag.to_pyobject(vm), |
| 190 | termios::cfgetispeed(&termios).to_pyobject(vm), |
| 191 | termios::cfgetospeed(&termios).to_pyobject(vm), |
| 192 | vm.ctx.new_list(cc).into(), |
| 193 | ]; |
| 194 | Ok(out) |
| 195 | } |
| 196 | |
| 197 | #[pyfunction] |
| 198 | fn tcsetattr(fd: i32, when: i32, attributes: PyListRef, vm: &VirtualMachine) -> PyResult<()> { |
nothing calls this directly
no test coverage detected