1# zx_process_create 2 3## NAME 4 5process_create - create a new process 6 7## SYNOPSIS 8 9``` 10#include <zircon/syscalls.h> 11 12zx_status_t zx_process_create(zx_handle_t job, const char* name, size_t name_size, 13 uint32_t options, zx_handle_t* proc_handle, 14 zx_handle_t* vmar_handle); 15 16``` 17 18## DESCRIPTION 19 20**process_create**() creates a new process. 21 22Upon success, handles for the new process and the root of its address space 23are returned. The thread will not start executing until *process_start()* is 24called. 25 26*name* is silently truncated to a maximum of *ZX_MAX_NAME_LEN-1* characters. 27 28When the last handle to a process is closed, the process is destroyed. 29 30Process handles may be waited on and will assert the signal 31*ZX_PROCESS_TERMINATED* when the process exits. 32 33*job* is the controlling [job object](../objects/job.md) for the new 34process, which will become a child of that job. 35 36## RIGHTS 37 38TODO(ZX-2399) 39 40## RETURN VALUE 41 42On success, **process_create**() returns **ZX_OK**, a handle to the new process 43(via *proc_handle*), and a handle to the root of its address space (via 44*vmar_handle*). In the event of failure, a negative error value is returned. 45 46## ERRORS 47 48**ZX_ERR_BAD_HANDLE** *job* is not a valid handle. 49 50**ZX_ERR_WRONG_TYPE** *job* is not a job handle. 51 52**ZX_ERR_ACCESS_DENIED** *job* does not have the **ZX_RIGHT_WRITE** right 53(only when not **ZX_HANDLE_INVALID**). 54 55**ZX_ERR_INVALID_ARGS** *name*, *proc_handle*, or *vmar_handle* was an invalid pointer, 56or *options* was non-zero. 57 58**ZX_ERR_NO_MEMORY** Failure due to lack of memory. 59There is no good way for userspace to handle this (unlikely) error. 60In a future build this error will no longer occur. 61 62**ZX_ERR_BAD_STATE** The job object is in the dead state. 63 64## SEE ALSO 65 66[handle_close](handle_close.md), 67[handle_duplicate](handle_duplicate.md), 68[object_wait_one](object_wait_one.md), 69[object_wait_many](object_wait_many.md), 70[process_start](process_start.md), 71[task_kill](task_kill.md), 72[thread_create](thread_create.md), 73[thread_exit](thread_exit.md), 74[thread_start](thread_start.md), 75[job_create](job_create.md). 76