/// open_node_in_namespace will return a NodeProxy to the given path by using the default namespace
/// stored in fdio. The path argument must be an absolute path.
open_node_in_namespace will return a NodeProxy to the given path by using the default namespace
stored in fdio. The path argument must be an absolute path.
open_node_in_namespace will return a NodeProxy to the given path by using the default namespace stored in fdio . The path argument must be an absolute path .
pub fn open_node_in_namespace(path: &str) -> Result<NodeProxy, Error> {
    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(format_err!("fdio_ns_get_installed error: {}", status));
    }
    let (proxy_chan, server_end) = zx::Channel::create()
        .map_err(|status| format_err!("zx::Channel::create error: {}", status))?;
    let cstr = CString::new(path)?;
    let status = unsafe {
        fdio::fdio_sys::fdio_ns_connect(
            ns_ptr,
            cstr.as_ptr(),
            OPEN_RIGHT_READABLE,
            server_end.into_raw(),
        )
    };
    if status != zx::sys::ZX_OK {
        return Err(format_err!("fdio_ns_connect error: {}", status));
    }
    return Ok(NodeProxy::new(fasync::Channel::from_channel(proxy_chan)?));
}
pub fn open_node_in_namespace ( path : & str ) -> Result < NodeProxy , Error > { 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 ( format_err ! ( " " status ) ) ; } let ( proxy_chan , server_end ) = zx :: Channel :: create ( ) . map_err ( | status | format_err ! ( " " status ) ) ? ; let cstr = CString :: new ( path ) ? ; let status = unsafe { fdio :: fdio_sys :: fdio_ns_connect ( ns_ptr , cstr . as_ptr ( ) , OPEN_RIGHT_READABLE , server_end . into_raw ( ) , ) } ; if status != zx :: sys :: ZX_OK { return Err ( format_err ! ( " " status ) ) ; } return Ok ( NodeProxy :: new ( fasync :: Channel :: from_channel ( proxy_chan ) ? ) ) ; }
open_node_in_namespace will return a NodeProxy to the given path by using the default namespace
stored in fdio.
open_node_in_namespace will return a NodeProxy to the given path by using the default namespace stored in fdio .
path
&str