pub fn connect_in_namespace(path: &str, server_chan: zx::Channel) -> Result<(), zx::Status> {
    let mut ns_ptr: *mut fdio::fdio_sys::fdio_ns_t = ptr::null_mut();
    let status = unsafe { fdio::fdio_sys::fdio_ns_get_installed(&mut ns_ptr) };
    if status != zx::sys::ZX_OK {
        return Err(zx::Status::from_raw(status));
    }

    let cstr = CString::new(path)?;
    let status = unsafe {
        fdio::fdio_sys::fdio_ns_connect(
            ns_ptr,
            cstr.as_ptr(),
            OPEN_RIGHT_READABLE,
            server_chan.into_raw(),
        )
    };
    if status != zx::sys::ZX_OK {
        return Err(zx::Status::from_raw(status));
    }
    Ok(())
}
/// Connect a zx::Channel to a path in the namespace.
Connect a zx::Channel to a path in the namespace.
Connect a zx :: Channel to a path in the namespace .
pub fn connect_in_namespace(path: &str, server_chan: zx::Channel) -> Result<(), zx::Status> {
    let mut ns_ptr: *mut fdio::fdio_sys::fdio_ns_t = ptr::null_mut();
    let status = unsafe { fdio::fdio_sys::fdio_ns_get_installed(&mut ns_ptr) };
    if status != zx::sys::ZX_OK {
        return Err(zx::Status::from_raw(status));
    }
    let cstr = CString::new(path)?;
    let status = unsafe {
        fdio::fdio_sys::fdio_ns_connect(
            ns_ptr,
            cstr.as_ptr(),
            OPEN_RIGHT_READABLE,
            server_chan.into_raw(),
        )
    };
    if status != zx::sys::ZX_OK {
        return Err(zx::Status::from_raw(status));
    }
    Ok(())
}
pub fn connect_in_namespace ( path : & str , server_chan : zx :: Channel ) -> Result < ( ) , zx :: Status > { let mut ns_ptr : * mut fdio :: fdio_sys :: fdio_ns_t = ptr :: null_mut ( ) ; let status = unsafe { fdio :: fdio_sys :: fdio_ns_get_installed ( & mut ns_ptr ) } ; if status != zx :: sys :: ZX_OK { return Err ( zx :: Status :: from_raw ( status ) ) ; } let cstr = CString :: new ( path ) ? ; let status = unsafe { fdio :: fdio_sys :: fdio_ns_connect ( ns_ptr , cstr . as_ptr ( ) , OPEN_RIGHT_READABLE , server_chan . into_raw ( ) , ) } ; if status != zx :: sys :: ZX_OK { return Err ( zx :: Status :: from_raw ( status ) ) ; } Ok ( ( ) ) }
Connect a zx::Channel to a path in the namespace.
Connect a zx :: Channel to a path in the namespace .
path
&str
server_chan
zx::Channel
path
&str
server_chan
zx::Channel