1use zx::sys::zx_handle_t;
6use zx::{Channel, HandleInfo, NullableHandle, Status};
7
8unsafe extern "C" {
9 fn TakeBootstrapChannel() -> zx_handle_t;
10}
11
12pub fn take_bootstrap_channel() -> Channel {
15 unsafe { NullableHandle::from_raw(TakeBootstrapChannel()) }.into()
16}
17
18pub use zx_libc::sanitizer::{Log, log};
20
21pub fn take_system_handles() -> Result<Vec<HandleInfo>, Status> {
24 let mut handles = Vec::new();
25 let channel = take_bootstrap_channel();
26 let mut bytes = Vec::new();
27 channel.read_etc_split(&mut bytes, &mut handles)?;
28 assert!(bytes.is_empty());
29 Ok(handles)
30}