1# zx_object_get_child
2
3## NAME
4
5<!-- Updated by update-docs-from-abigen, do not edit. -->
6
7object_get_child - Given a kernel object with children objects, obtain a handle to the child specified by the provided kernel object id.
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_object_get_child(zx_handle_t handle,
17                                uint64_t koid,
18                                zx_rights_t rights,
19                                zx_handle_t* out);
20```
21
22## DESCRIPTION
23
24`zx_object_get_child()` attempts to find a child of the object referred to
25by *handle* which has the kernel object id specified by *koid*.  If such an
26object exists, and the requested *rights* are not greater than those provided
27by the *handle* to the parent, a new handle to the specified child object is
28returned.
29
30*rights* may be **ZX_RIGHT_SAME_RIGHTS** which will result in rights equivalent
31to the those on the *handle*.
32
33If the object is a *Process*, the *Threads* it contains may be obtained by
34this call.
35
36If the object is a *Job*, its (immediate) child *Jobs* and the *Processes*
37it contains may be obtained by this call.
38
39If the object is a *Resource*, its (immediate) child *Resources* may be
40obtained by this call.
41
42
43## RIGHTS
44
45<!-- Updated by update-docs-from-abigen, do not edit. -->
46
47*handle* must have **ZX_RIGHT_ENUMERATE**.
48
49## RETURN VALUE
50
51On success, **ZX_OK** is returned and a handle to the desired child object is returned via *out*.
52
53
54## ERRORS
55
56**ZX_ERR_BAD_HANDLE**  *handle* is not a valid handle.
57
58**ZX_ERR_WRONG_TYPE**  *handle* is not a *Process*, *Job*, or *Resource*.
59
60**ZX_ERR_ACCESS_DENIED**   *handle* lacks the right **ZX_RIGHT_ENUMERATE** or *rights* specifies
61rights that are not present on *handle*.
62
63**ZX_ERR_NOT_FOUND**  *handle* does not have a child with the kernel object id *koid*.
64
65**ZX_ERR_NO_MEMORY**  Failure due to lack of memory.
66There is no good way for userspace to handle this (unlikely) error.
67In a future build this error will no longer occur.
68
69**ZX_ERR_INVALID_ARGS**  *out* is an invalid pointer.
70
71
72## SEE ALSO
73
74 - [`zx_handle_close()`]
75 - [`zx_handle_duplicate()`]
76 - [`zx_handle_replace()`]
77 - [`zx_object_get_info()`]
78
79<!-- References updated by update-docs-from-abigen, do not edit. -->
80
81[`zx_handle_close()`]: handle_close.md
82[`zx_handle_duplicate()`]: handle_duplicate.md
83[`zx_handle_replace()`]: handle_replace.md
84[`zx_object_get_info()`]: object_get_info.md
85