You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: syscalls.rs
    path of file: ./repos/rustix/src/backend/linux_raw/termios
    
    the code of the file until where you have to start completion: //! linux_raw syscalls supporting `rustix::termios`.
//!
//! # Safety
//!
//! See 
    
pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
    unsafe {
        let mut result = MaybeUninit::<Termios>::uninit();

        // QEMU's `TCGETS2` doesn't currently set `input_speed` or
        // `output_speed` on PowerPC, so zero out the fields ourselves.
        #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
        {
            result.write(core::mem::zeroed());
        }

        ret(syscall!(__NR_ioctl, fd, c_uint(c::TCGETS2), &mut result))?;

        let result = result.assume_init();

        // QEMU's `TCGETS2` doesn't currently set `input_speed` or
        // `output_speed` on PowerPC, so set them manually if we can.
        #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
        let result = {
            use crate::termios::speed;
            let mut result = result;
            if result.output_speed == 0 && (result.control_modes.bits() & c::CBAUD) != c::BOTHER {
                if let Some(output_speed) = speed::decode(result.control_modes.bits() & c::CBAUD) {
                    result.output_speed = output_speed;
                }
            }
            if result.input_speed == 0
                && ((result.control_modes.bits() & c::CIBAUD) >> c::IBSHIFT) != c::BOTHER
            {
                // For input speeds, `B0` is special-cased to mean the input
                // speed is the same as the output speed.
                if ((result.control_modes.bits() & c::CIBAUD) >> c::IBSHIFT) == c::B0 {
                    result.input_speed = result.output_speed;
                } else if let Some(input_speed) =
                    speed::decode((result.control_modes.bits() & c::CIBAUD) >> c::IBSHIFT)
                {
                    result.input_speed = input_speed;
                }
            }
            result
        };

        Ok(result)
    }
}