gidl_util

Function get_info_handle_valid

Source
pub fn get_info_handle_valid(
    handle_info: &zx_handle_info_t,
) -> Result<(), Status>
Expand description

Returns the result of the zx_object_get_info syscall with topic ZX_INFO_HANDLE_VALID. In particular, returns Status::BAD_HANDLE if the handle is dangling because it was already closed or never assigned to the process in the first place.

This should only be used in a single-threaded process immediately after a handle is created/closed, since “The kernel is free to re-use the integer values of closed handles for newly created objects”. https://fuchsia.dev/fuchsia-src/concepts/kernel/handles#invalid_handles_and_handle_reuse