1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13pub enum DispatcherState {
14 Running,
15 ShuttingDown,
16 Shutdown,
17 Destroyed,
18 #[doc(hidden)]
19 __SourceBreaking {
20 unknown_ordinal: u32,
21 },
22}
23
24#[macro_export]
26macro_rules! DispatcherStateUnknown {
27 () => {
28 _
29 };
30}
31
32impl DispatcherState {
33 #[inline]
34 pub fn from_primitive(prim: u32) -> Option<Self> {
35 match prim {
36 1 => Some(Self::Running),
37 2 => Some(Self::ShuttingDown),
38 3 => Some(Self::Shutdown),
39 4 => Some(Self::Destroyed),
40 _ => None,
41 }
42 }
43
44 #[inline]
45 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
46 match prim {
47 1 => Self::Running,
48 2 => Self::ShuttingDown,
49 3 => Self::Shutdown,
50 4 => Self::Destroyed,
51 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
52 }
53 }
54
55 #[inline]
56 pub fn unknown() -> Self {
57 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
58 }
59
60 #[inline]
61 pub const fn into_primitive(self) -> u32 {
62 match self {
63 Self::Running => 1,
64 Self::ShuttingDown => 2,
65 Self::Shutdown => 3,
66 Self::Destroyed => 4,
67 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
68 }
69 }
70
71 #[inline]
72 pub fn is_unknown(&self) -> bool {
73 match self {
74 Self::__SourceBreaking { unknown_ordinal: _ } => true,
75 _ => false,
76 }
77 }
78}
79
80#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
82#[repr(C)]
83pub struct DispatcherDebugStats {
84 pub num_total_requests: u64,
85 pub num_inlined_requests: u64,
86 pub non_inlined: NonInlinedRequestStats,
87}
88
89impl fidl::Persistable for DispatcherDebugStats {}
90
91#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
93pub struct DispatcherInfo {
94 pub driver: String,
95 pub name: String,
96 pub options: u32,
97 pub scheduler_role: String,
98 pub dispatcher_ptr: u64,
99 pub driver_ptr: u64,
100 pub synchronized: bool,
101 pub allow_sync_calls: bool,
102 pub state: DispatcherState,
103 pub destroy_context: String,
104 pub has_destroy_user_initiated: bool,
105 pub destroy_user_initiated: bool,
106 pub debug_stats: DispatcherDebugStats,
107 pub num_queued_tasks: u64,
108 pub queued_tasks: Vec<QueuedTaskInfo>,
109}
110
111impl fidl::Persistable for DispatcherInfo {}
112
113#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
115#[repr(C)]
116pub struct NonInlinedRequestStats {
117 pub allow_sync_calls: u64,
118 pub parallel_dispatch: u64,
119 pub task: u64,
120 pub unknown_thread: u64,
121 pub reentrant: u64,
122 pub channel_wait_not_yet_registered: u64,
123 pub no_thread_migration: u64,
124}
125
126impl fidl::Persistable for NonInlinedRequestStats {}
127
128#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
130pub struct ProcessInfo {
131 pub job_koid: u64,
132 pub process_koid: u64,
133 pub main_thread_koid: u64,
134 pub threads: Vec<ThreadInfo>,
135 pub dispatchers: Vec<DispatcherInfo>,
136}
137
138impl fidl::Persistable for ProcessInfo {}
139
140#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
142pub struct QueuedTaskInfo {
143 pub ptr: u64,
144 pub handler: u64,
145 pub initiating_dispatcher: u64,
146 pub initiating_dispatcher_name: String,
147 pub initiating_driver: u64,
148 pub initiating_driver_url: String,
149}
150
151impl fidl::Persistable for QueuedTaskInfo {}
152
153#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
155pub struct ThreadInfo {
156 pub koid: u64,
157 pub name: String,
158 pub scheduler_role: String,
159}
160
161impl fidl::Persistable for ThreadInfo {}
162
163pub mod driver_ordinals {
164 pub const STOP: u64 = 0x4039e87556689b5f;
165}
166
167pub mod driver_host_ordinals {
168 pub const START: u64 = 0x1848852bd195bde5;
169 pub const START_LOADED_DRIVER: u64 = 0x51957548318c9368;
170 pub const GET_PROCESS_INFO: u64 = 0x1b2d1b727a614973;
171 pub const INSTALL_LOADER: u64 = 0x7022edafc5fcf5a3;
172 pub const TRIGGER_STACK_TRACE: u64 = 0x3bb449b803e49353;
173 pub const FIND_DRIVER_CRASH_INFO_BY_THREAD_KOID: u64 = 0x18b3b336b45a7916;
174}
175
176mod internal {
177 use super::*;
178 unsafe impl fidl::encoding::TypeMarker for DispatcherState {
179 type Owned = Self;
180
181 #[inline(always)]
182 fn inline_align(_context: fidl::encoding::Context) -> usize {
183 std::mem::align_of::<u32>()
184 }
185
186 #[inline(always)]
187 fn inline_size(_context: fidl::encoding::Context) -> usize {
188 std::mem::size_of::<u32>()
189 }
190
191 #[inline(always)]
192 fn encode_is_copy() -> bool {
193 false
194 }
195
196 #[inline(always)]
197 fn decode_is_copy() -> bool {
198 false
199 }
200 }
201
202 impl fidl::encoding::ValueTypeMarker for DispatcherState {
203 type Borrowed<'a> = Self;
204 #[inline(always)]
205 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
206 *value
207 }
208 }
209
210 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
211 for DispatcherState
212 {
213 #[inline]
214 unsafe fn encode(
215 self,
216 encoder: &mut fidl::encoding::Encoder<'_, D>,
217 offset: usize,
218 _depth: fidl::encoding::Depth,
219 ) -> fidl::Result<()> {
220 encoder.debug_check_bounds::<Self>(offset);
221 encoder.write_num(self.into_primitive(), offset);
222 Ok(())
223 }
224 }
225
226 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DispatcherState {
227 #[inline(always)]
228 fn new_empty() -> Self {
229 Self::unknown()
230 }
231
232 #[inline]
233 unsafe fn decode(
234 &mut self,
235 decoder: &mut fidl::encoding::Decoder<'_, D>,
236 offset: usize,
237 _depth: fidl::encoding::Depth,
238 ) -> fidl::Result<()> {
239 decoder.debug_check_bounds::<Self>(offset);
240 let prim = decoder.read_num::<u32>(offset);
241
242 *self = Self::from_primitive_allow_unknown(prim);
243 Ok(())
244 }
245 }
246
247 impl fidl::encoding::ValueTypeMarker for DispatcherDebugStats {
248 type Borrowed<'a> = &'a Self;
249 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
250 value
251 }
252 }
253
254 unsafe impl fidl::encoding::TypeMarker for DispatcherDebugStats {
255 type Owned = Self;
256
257 #[inline(always)]
258 fn inline_align(_context: fidl::encoding::Context) -> usize {
259 8
260 }
261
262 #[inline(always)]
263 fn inline_size(_context: fidl::encoding::Context) -> usize {
264 72
265 }
266 #[inline(always)]
267 fn encode_is_copy() -> bool {
268 true
269 }
270
271 #[inline(always)]
272 fn decode_is_copy() -> bool {
273 true
274 }
275 }
276
277 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DispatcherDebugStats, D>
278 for &DispatcherDebugStats
279 {
280 #[inline]
281 unsafe fn encode(
282 self,
283 encoder: &mut fidl::encoding::Encoder<'_, D>,
284 offset: usize,
285 _depth: fidl::encoding::Depth,
286 ) -> fidl::Result<()> {
287 encoder.debug_check_bounds::<DispatcherDebugStats>(offset);
288 unsafe {
289 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
291 (buf_ptr as *mut DispatcherDebugStats)
292 .write_unaligned((self as *const DispatcherDebugStats).read());
293 }
296 Ok(())
297 }
298 }
299 unsafe impl<
300 D: fidl::encoding::ResourceDialect,
301 T0: fidl::encoding::Encode<u64, D>,
302 T1: fidl::encoding::Encode<u64, D>,
303 T2: fidl::encoding::Encode<NonInlinedRequestStats, D>,
304 > fidl::encoding::Encode<DispatcherDebugStats, D> for (T0, T1, T2)
305 {
306 #[inline]
307 unsafe fn encode(
308 self,
309 encoder: &mut fidl::encoding::Encoder<'_, D>,
310 offset: usize,
311 depth: fidl::encoding::Depth,
312 ) -> fidl::Result<()> {
313 encoder.debug_check_bounds::<DispatcherDebugStats>(offset);
314 self.0.encode(encoder, offset + 0, depth)?;
318 self.1.encode(encoder, offset + 8, depth)?;
319 self.2.encode(encoder, offset + 16, depth)?;
320 Ok(())
321 }
322 }
323
324 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DispatcherDebugStats {
325 #[inline(always)]
326 fn new_empty() -> Self {
327 Self {
328 num_total_requests: fidl::new_empty!(u64, D),
329 num_inlined_requests: fidl::new_empty!(u64, D),
330 non_inlined: fidl::new_empty!(NonInlinedRequestStats, D),
331 }
332 }
333
334 #[inline]
335 unsafe fn decode(
336 &mut self,
337 decoder: &mut fidl::encoding::Decoder<'_, D>,
338 offset: usize,
339 _depth: fidl::encoding::Depth,
340 ) -> fidl::Result<()> {
341 decoder.debug_check_bounds::<Self>(offset);
342 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
343 unsafe {
346 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 72);
347 }
348 Ok(())
349 }
350 }
351
352 impl fidl::encoding::ValueTypeMarker for DispatcherInfo {
353 type Borrowed<'a> = &'a Self;
354 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
355 value
356 }
357 }
358
359 unsafe impl fidl::encoding::TypeMarker for DispatcherInfo {
360 type Owned = Self;
361
362 #[inline(always)]
363 fn inline_align(_context: fidl::encoding::Context) -> usize {
364 8
365 }
366
367 #[inline(always)]
368 fn inline_size(_context: fidl::encoding::Context) -> usize {
369 200
370 }
371 }
372
373 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DispatcherInfo, D>
374 for &DispatcherInfo
375 {
376 #[inline]
377 unsafe fn encode(
378 self,
379 encoder: &mut fidl::encoding::Encoder<'_, D>,
380 offset: usize,
381 _depth: fidl::encoding::Depth,
382 ) -> fidl::Result<()> {
383 encoder.debug_check_bounds::<DispatcherInfo>(offset);
384 fidl::encoding::Encode::<DispatcherInfo, D>::encode(
386 (
387 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.driver),
388 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
389 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
390 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.scheduler_role),
391 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dispatcher_ptr),
392 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.driver_ptr),
393 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.synchronized),
394 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.allow_sync_calls),
395 <DispatcherState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
396 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.destroy_context),
397 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_destroy_user_initiated),
398 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.destroy_user_initiated),
399 <DispatcherDebugStats as fidl::encoding::ValueTypeMarker>::borrow(&self.debug_stats),
400 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_queued_tasks),
401 <fidl::encoding::UnboundedVector<QueuedTaskInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.queued_tasks),
402 ),
403 encoder, offset, _depth
404 )
405 }
406 }
407 unsafe impl<
408 D: fidl::encoding::ResourceDialect,
409 T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
410 T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
411 T2: fidl::encoding::Encode<u32, D>,
412 T3: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
413 T4: fidl::encoding::Encode<u64, D>,
414 T5: fidl::encoding::Encode<u64, D>,
415 T6: fidl::encoding::Encode<bool, D>,
416 T7: fidl::encoding::Encode<bool, D>,
417 T8: fidl::encoding::Encode<DispatcherState, D>,
418 T9: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
419 T10: fidl::encoding::Encode<bool, D>,
420 T11: fidl::encoding::Encode<bool, D>,
421 T12: fidl::encoding::Encode<DispatcherDebugStats, D>,
422 T13: fidl::encoding::Encode<u64, D>,
423 T14: fidl::encoding::Encode<fidl::encoding::UnboundedVector<QueuedTaskInfo>, D>,
424 > fidl::encoding::Encode<DispatcherInfo, D>
425 for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)
426 {
427 #[inline]
428 unsafe fn encode(
429 self,
430 encoder: &mut fidl::encoding::Encoder<'_, D>,
431 offset: usize,
432 depth: fidl::encoding::Depth,
433 ) -> fidl::Result<()> {
434 encoder.debug_check_bounds::<DispatcherInfo>(offset);
435 unsafe {
438 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
439 (ptr as *mut u64).write_unaligned(0);
440 }
441 unsafe {
442 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(72);
443 (ptr as *mut u64).write_unaligned(0);
444 }
445 unsafe {
446 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(96);
447 (ptr as *mut u64).write_unaligned(0);
448 }
449 self.0.encode(encoder, offset + 0, depth)?;
451 self.1.encode(encoder, offset + 16, depth)?;
452 self.2.encode(encoder, offset + 32, depth)?;
453 self.3.encode(encoder, offset + 40, depth)?;
454 self.4.encode(encoder, offset + 56, depth)?;
455 self.5.encode(encoder, offset + 64, depth)?;
456 self.6.encode(encoder, offset + 72, depth)?;
457 self.7.encode(encoder, offset + 73, depth)?;
458 self.8.encode(encoder, offset + 76, depth)?;
459 self.9.encode(encoder, offset + 80, depth)?;
460 self.10.encode(encoder, offset + 96, depth)?;
461 self.11.encode(encoder, offset + 97, depth)?;
462 self.12.encode(encoder, offset + 104, depth)?;
463 self.13.encode(encoder, offset + 176, depth)?;
464 self.14.encode(encoder, offset + 184, depth)?;
465 Ok(())
466 }
467 }
468
469 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DispatcherInfo {
470 #[inline(always)]
471 fn new_empty() -> Self {
472 Self {
473 driver: fidl::new_empty!(fidl::encoding::UnboundedString, D),
474 name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
475 options: fidl::new_empty!(u32, D),
476 scheduler_role: fidl::new_empty!(fidl::encoding::UnboundedString, D),
477 dispatcher_ptr: fidl::new_empty!(u64, D),
478 driver_ptr: fidl::new_empty!(u64, D),
479 synchronized: fidl::new_empty!(bool, D),
480 allow_sync_calls: fidl::new_empty!(bool, D),
481 state: fidl::new_empty!(DispatcherState, D),
482 destroy_context: fidl::new_empty!(fidl::encoding::UnboundedString, D),
483 has_destroy_user_initiated: fidl::new_empty!(bool, D),
484 destroy_user_initiated: fidl::new_empty!(bool, D),
485 debug_stats: fidl::new_empty!(DispatcherDebugStats, D),
486 num_queued_tasks: fidl::new_empty!(u64, D),
487 queued_tasks: fidl::new_empty!(fidl::encoding::UnboundedVector<QueuedTaskInfo>, D),
488 }
489 }
490
491 #[inline]
492 unsafe fn decode(
493 &mut self,
494 decoder: &mut fidl::encoding::Decoder<'_, D>,
495 offset: usize,
496 _depth: fidl::encoding::Depth,
497 ) -> fidl::Result<()> {
498 decoder.debug_check_bounds::<Self>(offset);
499 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
501 let padval = unsafe { (ptr as *const u64).read_unaligned() };
502 let mask = 0xffffffff00000000u64;
503 let maskedval = padval & mask;
504 if maskedval != 0 {
505 return Err(fidl::Error::NonZeroPadding {
506 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
507 });
508 }
509 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(72) };
510 let padval = unsafe { (ptr as *const u64).read_unaligned() };
511 let mask = 0xffff0000u64;
512 let maskedval = padval & mask;
513 if maskedval != 0 {
514 return Err(fidl::Error::NonZeroPadding {
515 padding_start: offset + 72 + ((mask as u64).trailing_zeros() / 8) as usize,
516 });
517 }
518 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(96) };
519 let padval = unsafe { (ptr as *const u64).read_unaligned() };
520 let mask = 0xffffffffffff0000u64;
521 let maskedval = padval & mask;
522 if maskedval != 0 {
523 return Err(fidl::Error::NonZeroPadding {
524 padding_start: offset + 96 + ((mask as u64).trailing_zeros() / 8) as usize,
525 });
526 }
527 fidl::decode!(
528 fidl::encoding::UnboundedString,
529 D,
530 &mut self.driver,
531 decoder,
532 offset + 0,
533 _depth
534 )?;
535 fidl::decode!(
536 fidl::encoding::UnboundedString,
537 D,
538 &mut self.name,
539 decoder,
540 offset + 16,
541 _depth
542 )?;
543 fidl::decode!(u32, D, &mut self.options, decoder, offset + 32, _depth)?;
544 fidl::decode!(
545 fidl::encoding::UnboundedString,
546 D,
547 &mut self.scheduler_role,
548 decoder,
549 offset + 40,
550 _depth
551 )?;
552 fidl::decode!(u64, D, &mut self.dispatcher_ptr, decoder, offset + 56, _depth)?;
553 fidl::decode!(u64, D, &mut self.driver_ptr, decoder, offset + 64, _depth)?;
554 fidl::decode!(bool, D, &mut self.synchronized, decoder, offset + 72, _depth)?;
555 fidl::decode!(bool, D, &mut self.allow_sync_calls, decoder, offset + 73, _depth)?;
556 fidl::decode!(DispatcherState, D, &mut self.state, decoder, offset + 76, _depth)?;
557 fidl::decode!(
558 fidl::encoding::UnboundedString,
559 D,
560 &mut self.destroy_context,
561 decoder,
562 offset + 80,
563 _depth
564 )?;
565 fidl::decode!(
566 bool,
567 D,
568 &mut self.has_destroy_user_initiated,
569 decoder,
570 offset + 96,
571 _depth
572 )?;
573 fidl::decode!(bool, D, &mut self.destroy_user_initiated, decoder, offset + 97, _depth)?;
574 fidl::decode!(
575 DispatcherDebugStats,
576 D,
577 &mut self.debug_stats,
578 decoder,
579 offset + 104,
580 _depth
581 )?;
582 fidl::decode!(u64, D, &mut self.num_queued_tasks, decoder, offset + 176, _depth)?;
583 fidl::decode!(
584 fidl::encoding::UnboundedVector<QueuedTaskInfo>,
585 D,
586 &mut self.queued_tasks,
587 decoder,
588 offset + 184,
589 _depth
590 )?;
591 Ok(())
592 }
593 }
594
595 impl fidl::encoding::ValueTypeMarker for NonInlinedRequestStats {
596 type Borrowed<'a> = &'a Self;
597 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
598 value
599 }
600 }
601
602 unsafe impl fidl::encoding::TypeMarker for NonInlinedRequestStats {
603 type Owned = Self;
604
605 #[inline(always)]
606 fn inline_align(_context: fidl::encoding::Context) -> usize {
607 8
608 }
609
610 #[inline(always)]
611 fn inline_size(_context: fidl::encoding::Context) -> usize {
612 56
613 }
614 #[inline(always)]
615 fn encode_is_copy() -> bool {
616 true
617 }
618
619 #[inline(always)]
620 fn decode_is_copy() -> bool {
621 true
622 }
623 }
624
625 unsafe impl<D: fidl::encoding::ResourceDialect>
626 fidl::encoding::Encode<NonInlinedRequestStats, D> for &NonInlinedRequestStats
627 {
628 #[inline]
629 unsafe fn encode(
630 self,
631 encoder: &mut fidl::encoding::Encoder<'_, D>,
632 offset: usize,
633 _depth: fidl::encoding::Depth,
634 ) -> fidl::Result<()> {
635 encoder.debug_check_bounds::<NonInlinedRequestStats>(offset);
636 unsafe {
637 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
639 (buf_ptr as *mut NonInlinedRequestStats)
640 .write_unaligned((self as *const NonInlinedRequestStats).read());
641 }
644 Ok(())
645 }
646 }
647 unsafe impl<
648 D: fidl::encoding::ResourceDialect,
649 T0: fidl::encoding::Encode<u64, D>,
650 T1: fidl::encoding::Encode<u64, D>,
651 T2: fidl::encoding::Encode<u64, D>,
652 T3: fidl::encoding::Encode<u64, D>,
653 T4: fidl::encoding::Encode<u64, D>,
654 T5: fidl::encoding::Encode<u64, D>,
655 T6: fidl::encoding::Encode<u64, D>,
656 > fidl::encoding::Encode<NonInlinedRequestStats, D> for (T0, T1, T2, T3, T4, T5, T6)
657 {
658 #[inline]
659 unsafe fn encode(
660 self,
661 encoder: &mut fidl::encoding::Encoder<'_, D>,
662 offset: usize,
663 depth: fidl::encoding::Depth,
664 ) -> fidl::Result<()> {
665 encoder.debug_check_bounds::<NonInlinedRequestStats>(offset);
666 self.0.encode(encoder, offset + 0, depth)?;
670 self.1.encode(encoder, offset + 8, depth)?;
671 self.2.encode(encoder, offset + 16, depth)?;
672 self.3.encode(encoder, offset + 24, depth)?;
673 self.4.encode(encoder, offset + 32, depth)?;
674 self.5.encode(encoder, offset + 40, depth)?;
675 self.6.encode(encoder, offset + 48, depth)?;
676 Ok(())
677 }
678 }
679
680 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
681 for NonInlinedRequestStats
682 {
683 #[inline(always)]
684 fn new_empty() -> Self {
685 Self {
686 allow_sync_calls: fidl::new_empty!(u64, D),
687 parallel_dispatch: fidl::new_empty!(u64, D),
688 task: fidl::new_empty!(u64, D),
689 unknown_thread: fidl::new_empty!(u64, D),
690 reentrant: fidl::new_empty!(u64, D),
691 channel_wait_not_yet_registered: fidl::new_empty!(u64, D),
692 no_thread_migration: fidl::new_empty!(u64, D),
693 }
694 }
695
696 #[inline]
697 unsafe fn decode(
698 &mut self,
699 decoder: &mut fidl::encoding::Decoder<'_, D>,
700 offset: usize,
701 _depth: fidl::encoding::Depth,
702 ) -> fidl::Result<()> {
703 decoder.debug_check_bounds::<Self>(offset);
704 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
705 unsafe {
708 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
709 }
710 Ok(())
711 }
712 }
713
714 impl fidl::encoding::ValueTypeMarker for ProcessInfo {
715 type Borrowed<'a> = &'a Self;
716 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
717 value
718 }
719 }
720
721 unsafe impl fidl::encoding::TypeMarker for ProcessInfo {
722 type Owned = Self;
723
724 #[inline(always)]
725 fn inline_align(_context: fidl::encoding::Context) -> usize {
726 8
727 }
728
729 #[inline(always)]
730 fn inline_size(_context: fidl::encoding::Context) -> usize {
731 56
732 }
733 }
734
735 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProcessInfo, D>
736 for &ProcessInfo
737 {
738 #[inline]
739 unsafe fn encode(
740 self,
741 encoder: &mut fidl::encoding::Encoder<'_, D>,
742 offset: usize,
743 _depth: fidl::encoding::Depth,
744 ) -> fidl::Result<()> {
745 encoder.debug_check_bounds::<ProcessInfo>(offset);
746 fidl::encoding::Encode::<ProcessInfo, D>::encode(
748 (
749 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.job_koid),
750 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.process_koid),
751 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.main_thread_koid),
752 <fidl::encoding::UnboundedVector<ThreadInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.threads),
753 <fidl::encoding::UnboundedVector<DispatcherInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.dispatchers),
754 ),
755 encoder, offset, _depth
756 )
757 }
758 }
759 unsafe impl<
760 D: fidl::encoding::ResourceDialect,
761 T0: fidl::encoding::Encode<u64, D>,
762 T1: fidl::encoding::Encode<u64, D>,
763 T2: fidl::encoding::Encode<u64, D>,
764 T3: fidl::encoding::Encode<fidl::encoding::UnboundedVector<ThreadInfo>, D>,
765 T4: fidl::encoding::Encode<fidl::encoding::UnboundedVector<DispatcherInfo>, D>,
766 > fidl::encoding::Encode<ProcessInfo, D> for (T0, T1, T2, T3, T4)
767 {
768 #[inline]
769 unsafe fn encode(
770 self,
771 encoder: &mut fidl::encoding::Encoder<'_, D>,
772 offset: usize,
773 depth: fidl::encoding::Depth,
774 ) -> fidl::Result<()> {
775 encoder.debug_check_bounds::<ProcessInfo>(offset);
776 self.0.encode(encoder, offset + 0, depth)?;
780 self.1.encode(encoder, offset + 8, depth)?;
781 self.2.encode(encoder, offset + 16, depth)?;
782 self.3.encode(encoder, offset + 24, depth)?;
783 self.4.encode(encoder, offset + 40, depth)?;
784 Ok(())
785 }
786 }
787
788 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProcessInfo {
789 #[inline(always)]
790 fn new_empty() -> Self {
791 Self {
792 job_koid: fidl::new_empty!(u64, D),
793 process_koid: fidl::new_empty!(u64, D),
794 main_thread_koid: fidl::new_empty!(u64, D),
795 threads: fidl::new_empty!(fidl::encoding::UnboundedVector<ThreadInfo>, D),
796 dispatchers: fidl::new_empty!(fidl::encoding::UnboundedVector<DispatcherInfo>, D),
797 }
798 }
799
800 #[inline]
801 unsafe fn decode(
802 &mut self,
803 decoder: &mut fidl::encoding::Decoder<'_, D>,
804 offset: usize,
805 _depth: fidl::encoding::Depth,
806 ) -> fidl::Result<()> {
807 decoder.debug_check_bounds::<Self>(offset);
808 fidl::decode!(u64, D, &mut self.job_koid, decoder, offset + 0, _depth)?;
810 fidl::decode!(u64, D, &mut self.process_koid, decoder, offset + 8, _depth)?;
811 fidl::decode!(u64, D, &mut self.main_thread_koid, decoder, offset + 16, _depth)?;
812 fidl::decode!(
813 fidl::encoding::UnboundedVector<ThreadInfo>,
814 D,
815 &mut self.threads,
816 decoder,
817 offset + 24,
818 _depth
819 )?;
820 fidl::decode!(
821 fidl::encoding::UnboundedVector<DispatcherInfo>,
822 D,
823 &mut self.dispatchers,
824 decoder,
825 offset + 40,
826 _depth
827 )?;
828 Ok(())
829 }
830 }
831
832 impl fidl::encoding::ValueTypeMarker for QueuedTaskInfo {
833 type Borrowed<'a> = &'a Self;
834 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
835 value
836 }
837 }
838
839 unsafe impl fidl::encoding::TypeMarker for QueuedTaskInfo {
840 type Owned = Self;
841
842 #[inline(always)]
843 fn inline_align(_context: fidl::encoding::Context) -> usize {
844 8
845 }
846
847 #[inline(always)]
848 fn inline_size(_context: fidl::encoding::Context) -> usize {
849 64
850 }
851 }
852
853 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<QueuedTaskInfo, D>
854 for &QueuedTaskInfo
855 {
856 #[inline]
857 unsafe fn encode(
858 self,
859 encoder: &mut fidl::encoding::Encoder<'_, D>,
860 offset: usize,
861 _depth: fidl::encoding::Depth,
862 ) -> fidl::Result<()> {
863 encoder.debug_check_bounds::<QueuedTaskInfo>(offset);
864 fidl::encoding::Encode::<QueuedTaskInfo, D>::encode(
866 (
867 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.ptr),
868 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.handler),
869 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.initiating_dispatcher),
870 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
871 &self.initiating_dispatcher_name,
872 ),
873 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.initiating_driver),
874 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
875 &self.initiating_driver_url,
876 ),
877 ),
878 encoder,
879 offset,
880 _depth,
881 )
882 }
883 }
884 unsafe impl<
885 D: fidl::encoding::ResourceDialect,
886 T0: fidl::encoding::Encode<u64, D>,
887 T1: fidl::encoding::Encode<u64, D>,
888 T2: fidl::encoding::Encode<u64, D>,
889 T3: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
890 T4: fidl::encoding::Encode<u64, D>,
891 T5: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
892 > fidl::encoding::Encode<QueuedTaskInfo, D> for (T0, T1, T2, T3, T4, T5)
893 {
894 #[inline]
895 unsafe fn encode(
896 self,
897 encoder: &mut fidl::encoding::Encoder<'_, D>,
898 offset: usize,
899 depth: fidl::encoding::Depth,
900 ) -> fidl::Result<()> {
901 encoder.debug_check_bounds::<QueuedTaskInfo>(offset);
902 self.0.encode(encoder, offset + 0, depth)?;
906 self.1.encode(encoder, offset + 8, depth)?;
907 self.2.encode(encoder, offset + 16, depth)?;
908 self.3.encode(encoder, offset + 24, depth)?;
909 self.4.encode(encoder, offset + 40, depth)?;
910 self.5.encode(encoder, offset + 48, depth)?;
911 Ok(())
912 }
913 }
914
915 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for QueuedTaskInfo {
916 #[inline(always)]
917 fn new_empty() -> Self {
918 Self {
919 ptr: fidl::new_empty!(u64, D),
920 handler: fidl::new_empty!(u64, D),
921 initiating_dispatcher: fidl::new_empty!(u64, D),
922 initiating_dispatcher_name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
923 initiating_driver: fidl::new_empty!(u64, D),
924 initiating_driver_url: fidl::new_empty!(fidl::encoding::UnboundedString, D),
925 }
926 }
927
928 #[inline]
929 unsafe fn decode(
930 &mut self,
931 decoder: &mut fidl::encoding::Decoder<'_, D>,
932 offset: usize,
933 _depth: fidl::encoding::Depth,
934 ) -> fidl::Result<()> {
935 decoder.debug_check_bounds::<Self>(offset);
936 fidl::decode!(u64, D, &mut self.ptr, decoder, offset + 0, _depth)?;
938 fidl::decode!(u64, D, &mut self.handler, decoder, offset + 8, _depth)?;
939 fidl::decode!(u64, D, &mut self.initiating_dispatcher, decoder, offset + 16, _depth)?;
940 fidl::decode!(
941 fidl::encoding::UnboundedString,
942 D,
943 &mut self.initiating_dispatcher_name,
944 decoder,
945 offset + 24,
946 _depth
947 )?;
948 fidl::decode!(u64, D, &mut self.initiating_driver, decoder, offset + 40, _depth)?;
949 fidl::decode!(
950 fidl::encoding::UnboundedString,
951 D,
952 &mut self.initiating_driver_url,
953 decoder,
954 offset + 48,
955 _depth
956 )?;
957 Ok(())
958 }
959 }
960
961 impl fidl::encoding::ValueTypeMarker for ThreadInfo {
962 type Borrowed<'a> = &'a Self;
963 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
964 value
965 }
966 }
967
968 unsafe impl fidl::encoding::TypeMarker for ThreadInfo {
969 type Owned = Self;
970
971 #[inline(always)]
972 fn inline_align(_context: fidl::encoding::Context) -> usize {
973 8
974 }
975
976 #[inline(always)]
977 fn inline_size(_context: fidl::encoding::Context) -> usize {
978 40
979 }
980 }
981
982 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ThreadInfo, D>
983 for &ThreadInfo
984 {
985 #[inline]
986 unsafe fn encode(
987 self,
988 encoder: &mut fidl::encoding::Encoder<'_, D>,
989 offset: usize,
990 _depth: fidl::encoding::Depth,
991 ) -> fidl::Result<()> {
992 encoder.debug_check_bounds::<ThreadInfo>(offset);
993 fidl::encoding::Encode::<ThreadInfo, D>::encode(
995 (
996 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.koid),
997 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
998 &self.name,
999 ),
1000 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1001 &self.scheduler_role,
1002 ),
1003 ),
1004 encoder,
1005 offset,
1006 _depth,
1007 )
1008 }
1009 }
1010 unsafe impl<
1011 D: fidl::encoding::ResourceDialect,
1012 T0: fidl::encoding::Encode<u64, D>,
1013 T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1014 T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1015 > fidl::encoding::Encode<ThreadInfo, D> for (T0, T1, T2)
1016 {
1017 #[inline]
1018 unsafe fn encode(
1019 self,
1020 encoder: &mut fidl::encoding::Encoder<'_, D>,
1021 offset: usize,
1022 depth: fidl::encoding::Depth,
1023 ) -> fidl::Result<()> {
1024 encoder.debug_check_bounds::<ThreadInfo>(offset);
1025 self.0.encode(encoder, offset + 0, depth)?;
1029 self.1.encode(encoder, offset + 8, depth)?;
1030 self.2.encode(encoder, offset + 24, depth)?;
1031 Ok(())
1032 }
1033 }
1034
1035 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ThreadInfo {
1036 #[inline(always)]
1037 fn new_empty() -> Self {
1038 Self {
1039 koid: fidl::new_empty!(u64, D),
1040 name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1041 scheduler_role: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1042 }
1043 }
1044
1045 #[inline]
1046 unsafe fn decode(
1047 &mut self,
1048 decoder: &mut fidl::encoding::Decoder<'_, D>,
1049 offset: usize,
1050 _depth: fidl::encoding::Depth,
1051 ) -> fidl::Result<()> {
1052 decoder.debug_check_bounds::<Self>(offset);
1053 fidl::decode!(u64, D, &mut self.koid, decoder, offset + 0, _depth)?;
1055 fidl::decode!(
1056 fidl::encoding::UnboundedString,
1057 D,
1058 &mut self.name,
1059 decoder,
1060 offset + 8,
1061 _depth
1062 )?;
1063 fidl::decode!(
1064 fidl::encoding::UnboundedString,
1065 D,
1066 &mut self.scheduler_role,
1067 decoder,
1068 offset + 24,
1069 _depth
1070 )?;
1071 Ok(())
1072 }
1073 }
1074}