Kick a thread out of restricted mode.


#include <zircon/syscalls-next.h>

zx_status_t zx_restricted_kick(zx_handle_t thread, uint32_t options);


Kicks a thread out of restricted mode if it is currently running in restricted mode or saves a pending kick if it is not. If the target thread is running in restricted mode, it will exit to normal mode through the entry point provided to zx_restricted_enter with a reason code set to ZX_RESTRICTED_REASON_KICK. Otherwise the next call to zx_restricted_enter will not enter restricted mode and will instead dispatch to the provided entry point with reason code ZX_RESTRICTED_REASON_KICK.

Multiple kicks on the same thread object are collapsed together. Thus if multiple threads call zx_restricted_kick on the same target while it is running or entering restricted mode, at least one but possibly multiple ZX_RESTRICTED_REASON_KICK returns will be observed. The recommended way to use this syscall is to first record a reason for kicking in a synchronized data structure and then call zx_restricted_kick. The thread calling zx_restricted_enter should consult this data structure whenever it observes ZX_RESTRICTED_REASON_KICK and process any pending state before reentering restricted mode.

options must be zero.


ZX_RIGHT_MANAGE_THREAD is required on thread.


ZX_ERR_INVALID_ARGS options is any value other than 0. ZX_ERR_WRONG_TYPE thread is not a thread. ZX_ERR_ACCESS_DENIED thread does not have ZX_RIGHT_MANAGE_THREAD. ZX_ERR_BAD_STATE thread is dead.