1# zx_job_create
2
3## NAME
4
5job_create - create a new job
6
7## SYNOPSIS
8
9```
10#include <zircon/syscalls.h>
11
12zx_status_t zx_job_create(zx_handle_t job, uint32_t options, zx_handle_t* out);
13
14```
15
16## DESCRIPTION
17
18**job_create**() creates a new child [job object](../objects/job.md) given a
19parent job.
20
21Upon success a handle for the new job is returned.
22
23The kernel keeps track of and restricts the "height" of a job, which is its
24distance from the root job. It is illegal to create a job under a parent whose
25height exceeds an internal "max height" value. (It is, however, legal to create
26a process under such a job.)
27
28Job handles may be waited on (TODO(cpu): expand this)
29
30## RIGHTS
31
32TODO(ZX-2399)
33
34## RETURN VALUE
35
36**job_create**() returns ZX_OK and a handle to the new job
37(via *out*) on success.  In the event of failure, a negative error value
38is returned.
39
40## ERRORS
41
42**ZX_ERR_BAD_HANDLE**  *job* is not a valid handle.
43
44**ZX_ERR_WRONG_TYPE**  *job* is not a job handle.
45
46**ZX_ERR_INVALID_ARGS**  *options* is nonzero, or *out* is an invalid pointer.
47
48**ZX_ERR_ACCESS_DENIED**  *job* does not have the **ZX_RIGHT_WRITE** or **ZX_RIGHT_MANAGE_JOB** right.
49
50**ZX_ERR_OUT_OF_RANGE**  The height of *job* is too large to create a child job.
51
52**ZX_ERR_NO_MEMORY**  Failure due to lack of memory.
53There is no good way for userspace to handle this (unlikely) error.
54In a future build this error will no longer occur.
55
56**ZX_ERR_BAD_STATE**  The parent job object is in the dead state.
57
58## SEE ALSO
59
60[process_create](process_create.md),
61[task_kill](task_kill.md),
62[object_get_property](object_get_property.md).
63