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: ioctl.rs
    path of file: ./repos/remote-pty/remote-pty-slave/src/intercept
    
    the code of the file until where you have to start completion: use errno::{set_errno, Errno};
use remote_pty_common::{
    channel::{Channel, RemoteChannel},
    log::debug,
    proto::{
        slave::{
            IoctlCall, IoctlResponse, IoctlValueResponse, PtySlaveCall, PtySlaveCallType,
            PtySlaveResponse,
        },
        Fd,
    },
};

use crate::{common::handle_intercept, error::generic_error, intercept};

#[cfg(target_os = "linux")]
type Cmd = libc::Ioctl;
#[cfg(not(target_os = "linux"))]
type Cmd = libc::c_
    
    fn test_ioctl_fionread() {
        let expected_req = PtySlaveCall {
            fd: Fd(1),
            typ: PtySlaveCallType::Ioctl(IoctlCall::FIONREAD),
        };
        let mock_res = PtySlaveResponse::Ioctl(IoctlResponse {
            ret: 0,
            val: IoctlValueResponse::Int(10),
        });

        let mock = MockChannel::assert_sends(Channel::PTY, vec![expected_req], vec![mock_res]);
        let val = &mut (0 as libc::c_int) as *mut libc::c_int;

        let res = ioctl_chan(
            mock.chan.clone(),
            1,
            libc::FIONREAD,
            val as *mut _ as *mut libc::c_void,
        );

        assert_eq!(res, 0);
        assert_eq!(unsafe { *val }, 10 as libc::c_int);
    }