fn send_to_client(
    socket: &Socket,
    wayland_channel: &mut zx::Channel,
    kernel: &Kernel,
) -> Result<(), Errno> {
    let mut buffer = zx::MessageBuf::new();
    match wayland_channel.read(&mut buffer) {
        Err(zx::Status::SHOULD_WAIT) => {}
        Err(_) => {}
        Ok(_) => {
            let mut files: Vec<FileHandle> = vec![];
            while let Some(handle) = buffer.take_handle(0) {
                let vmo = zx::Vmo::from(handle);
                let file = Anon::new_file(
                    anon_fs(&kernel),
                    Box::new(VmoFileObject::new(Arc::new(vmo))),
                    OpenFlags::RDWR,
                );
                files.push(file);
            }
            let ancillary_data = if !files.is_empty() {
                Some(AncillaryData::Unix(UnixControlData::Rights(files)))
            } else {
                None
            };
            let message = Message::new(buffer.bytes().to_vec().into(), None, ancillary_data);
            socket.write_kernel(message)?;
        }
    };

    Ok(())
}
/// Sends any data currently in `wayland_channel` to `socket`.
///
/// Any handles that are part of the channel message are first converted into files, prior to being
/// passed over the socket.
Sends any data currently in `wayland_channel` to `socket`.
Any handles that are part of the channel message are first converted into files, prior to being
passed over the socket.
Sends any data currently in ` wayland_channel ` to ` socket ` . Any handles that are part of the channel message are first converted into files prior to being passed over the socket .
fn send_to_client(
    socket: &Socket,
    wayland_channel: &mut zx::Channel,
    kernel: &Kernel,
) -> Result<(), Errno> {
    let mut buffer = zx::MessageBuf::new();
    match wayland_channel.read(&mut buffer) {
        Err(zx::Status::SHOULD_WAIT) => {}
        Err(_) => {}
        Ok(_) => {
            let mut files: Vec<FileHandle> = vec![];
            while let Some(handle) = buffer.take_handle(0) {
                let vmo = zx::Vmo::from(handle);
                let file = Anon::new_file(
                    anon_fs(&kernel),
                    Box::new(VmoFileObject::new(Arc::new(vmo))),
                    OpenFlags::RDWR,
                );
                files.push(file);
            }
            let ancillary_data = if !files.is_empty() {
                Some(AncillaryData::Unix(UnixControlData::Rights(files)))
            } else {
                None
            };
            let message = Message::new(buffer.bytes().to_vec().into(), None, ancillary_data);
            socket.write_kernel(message)?;
        }
    };
    Ok(())
}
fn send_to_client ( socket : & Socket , wayland_channel : & mut zx :: Channel , kernel : & Kernel , ) -> Result < ( ) , Errno > { let mut buffer = zx :: MessageBuf :: new ( ) ; match wayland_channel . read ( & mut buffer ) { Err ( zx :: Status :: SHOULD_WAIT ) => { } Err ( _ ) => { } Ok ( _ ) => { let mut files : Vec < FileHandle > = vec ! [ ] ; while let Some ( handle ) = buffer . take_handle ( 0 ) { let vmo = zx :: Vmo :: from ( handle ) ; let file = Anon :: new_file ( anon_fs ( & kernel ) , Box :: new ( VmoFileObject :: new ( Arc :: new ( vmo ) ) ) , OpenFlags :: RDWR , ) ; files . push ( file ) ; } let ancillary_data = if ! files . is_empty ( ) { Some ( AncillaryData :: Unix ( UnixControlData :: Rights ( files ) ) ) } else { None } ; let message = Message :: new ( buffer . bytes ( ) . to_vec ( ) . into ( ) , None , ancillary_data ) ; socket . write_kernel ( message ) ? ; } } ; Ok ( ( ) ) }
Sends any data currently in `wayland_channel` to `socket`.
Sends any data currently in ` wayland_channel ` to ` socket ` .
socket
&Socket
wayland_channel
&mut zx::Channel
kernel
&Kernel
socket
&Socket
wayland_channel
&mut zx::Channel
kernel
&Kernel