1# zx_handle_close
2
3## NAME
4
5<!-- Updated by update-docs-from-abigen, do not edit. -->
6
7handle_close - close a handle
8
9## SYNOPSIS
10
11<!-- Updated by update-docs-from-abigen, do not edit. -->
12
13```
14#include <zircon/syscalls.h>
15
16zx_status_t zx_handle_close(zx_handle_t handle);
17```
18
19## DESCRIPTION
20
21`zx_handle_close()` closes a *handle*, causing the underlying object to be
22reclaimed by the kernel if no other handles to it exist.
23
24If the *handle* was used in a pending [`zx_object_wait_one()`] or a
25[`zx_object_wait_many()`] call, the wait will be aborted.
26
27It is not an error to close the special "never a valid handle" **ZX_HANDLE_INVALID**,
28similar to `free(NULL)` being a valid call.
29
30## RIGHTS
31
32<!-- Updated by update-docs-from-abigen, do not edit. -->
33
34None.
35
36## RETURN VALUE
37
38`zx_handle_close()` returns **ZX_OK** on success.
39
40## ERRORS
41
42**ZX_ERR_BAD_HANDLE**  *handle* isn't a valid handle.
43
44## SEE ALSO
45
46 - [`zx_handle_close_many()`]
47 - [`zx_handle_duplicate()`]
48 - [`zx_handle_replace()`]
49
50<!-- References updated by update-docs-from-abigen, do not edit. -->
51
52[`zx_handle_close_many()`]: handle_close_many.md
53[`zx_handle_duplicate()`]: handle_duplicate.md
54[`zx_handle_replace()`]: handle_replace.md
55[`zx_object_wait_many()`]: object_wait_many.md
56[`zx_object_wait_one()`]: object_wait_one.md
57