1 // Copyright 2017 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <zircon/syscalls.h>
8 
9 #include <unittest/unittest.h>
10 
11 __BEGIN_CDECLS
12 
13 /** Returns a new list for registering processes and threads expected to crash. */
14 crash_list_t crash_list_new(void);
15 
16 /**
17  * Registers the process or thread as expected to crash.
18  */
19 void crash_list_register(crash_list_t crash_list, zx_handle_t handle);
20 
21 /**
22  * Lookup the given koid and returns the process or thread handle, or
23  * ZX_HANDLE_INVALID if no match was found.
24  */
25 zx_handle_t crash_list_lookup_koid(crash_list_t crash_list,
26                                    zx_koid_t koid);
27 
28 /**
29  * Deletes the node with the given koid and returns the process or thread handle, or
30  * ZX_HANDLE_INVALID if no match was found.
31  */
32 zx_handle_t crash_list_delete_koid(crash_list_t crash_list,
33                                    zx_koid_t koid);
34 
35 /**
36  * Deletes the list. Returns whether any elements were deleted.
37  */
38 bool crash_list_delete(crash_list_t crash_list);
39 
40 __END_CDECLS
41