1# zx_task_kill 2 3## NAME 4 5<!-- Updated by update-docs-from-abigen, do not edit. --> 6 7task_kill - Kill the provided task (job, process, or thread). 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_task_kill(zx_handle_t handle); 17``` 18 19## DESCRIPTION 20 21This asynchronously kills the given process, thread or job and its children 22recursively, until the entire task tree rooted at *handle* is dead. 23 24It is possible to wait for the task to be dead via the **ZX_TASK_TERMINATED** 25signal. When the procedure completes, as observed by the signal, the task and 26all its children are considered to be in the dead state and most operations 27will no longer succeed. 28 29If *handle* is a job and the syscall is successful, the job cannot longer be 30used to create new processes. 31 32## RIGHTS 33 34<!-- Updated by update-docs-from-abigen, do not edit. --> 35 36*handle* must have **ZX_RIGHT_DESTROY**. 37 38## RETURN VALUE 39 40On success, `zx_task_kill()` returns **ZX_OK**. If a process or thread uses 41this syscall to kill itself, this syscall does not return. 42 43## NOTES 44 45When using this syscall on a process, the return code for the process 46is -1 as reported by [`zx_object_get_info()`] via the **ZX_INFO_PROCESS** topic. 47 48## ERRORS 49 50**ZX_ERR_BAD_HANDLE** *handle* is not a valid handle. 51 52**ZX_ERR_WRONG_TYPE** *handle* is not a task handle. 53 54**ZX_ERR_ACCESS_DENIED** *handle* does not have the **ZX_RIGHT_DESTROY** 55right. 56 57## SEE ALSO 58 59 - [`zx_job_create()`] 60 - [`zx_process_create()`] 61 62<!-- References updated by update-docs-from-abigen, do not edit. --> 63 64[`zx_job_create()`]: job_create.md 65[`zx_object_get_info()`]: object_get_info.md 66[`zx_process_create()`]: process_create.md 67