class ProcessDispatcher
Defined at line 53 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
Public Methods
zx_status_t Create (fbl::RefPtr<JobDispatcher>job,ktl::string_viewname,uint32_tflags,KernelHandle<ProcessDispatcher> *handle,zx_rights_t *rights,KernelHandle<VmAddressRegionDispatcher> *root_vmar_handle,zx_rights_t *root_vmar_rights)
Defined at line 80 of file ../../zircon/kernel/object/process_dispatcher.cc
ProcessDispatcher * GetCurrent ()
Defined at line 81 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
void ExitCurrent (int64_t retcode)
Defined at line 87 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
zx_obj_type_t get_type ()
Dispatcher implementation
Defined at line 94 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
zx_status_t CreateShared (fbl::RefPtr<ProcessDispatcher>shared_proc,ktl::string_viewname,uint32_tflags,KernelHandle<ProcessDispatcher> *handle,zx_rights_t *rights,KernelHandle<VmAddressRegionDispatcher> *restricted_vmar_handle,zx_rights_t *restricted_vmar_rights)
Creates a new process dispatcher for a process that will share its `shareable_state_` with
other processes.
The shared state will be instantiated from `shared_proc`.
`restricted_vmar_handle` is the VMAR for the restricted aspace.
Defined at line 131 of file ../../zircon/kernel/object/process_dispatcher.cc
HandleTable & handle_table ()
Accessors.
Defined at line 134 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
const HandleTable & handle_table ()
Defined at line 135 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
FutexContext & futex_context ()
Defined at line 137 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
uintptr_t hw_trace_context_id ()
Returns an identifier that can be used to associate hardware trace
data with this process.
Defined at line 146 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
uintptr_t arch_table_phys ()
Defined at line 152 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
uintptr_t vdso_base_address ()
Defined at line 157 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
void EnumerateAspaceChildren (VmEnumerator * ve)
Defined at line 159 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
void DumpAspace (bool verbose)
Defined at line 172 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
void ~ProcessDispatcher ()
Defined at line 206 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_info_task_runtime_t GetRuntimeStats ()
Defined at line 207 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
void on_zero_handles ()
Defined at line 223 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_koid_t get_related_koid ()
Defined at line 512 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t Initialize ()
Performs initialization on a newly constructed ProcessDispatcher
This should be used to initialize ProcessDispatchers without a restricted aspace.
If this fails, then the object is invalid and should be deleted
Defined at line 250 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t Initialize (SharedAspaceType type)
Performs initialization on a newly constructed ProcessDispatcher
If this fails, then the object is invalid and should be deleted
This should be used to initialize ProcessDispatchers with a restricted aspace.
|type| is used to determine how to initialize the restricted and normal aspaces.
Defined at line 268 of file ../../zircon/kernel/object/process_dispatcher.cc
VmAspace * aspace_at (vaddr_t va)
Returns a pointer to the process's VmAspace containing |va| if such an aspace exists, otherwise
it returns the normal aspace of the process.
Defined at line 1044 of file ../../zircon/kernel/object/process_dispatcher.cc
State state ()
Defined at line 514 of file ../../zircon/kernel/object/process_dispatcher.cc
fbl::RefPtr<JobDispatcher> job ()
Defined at line 519 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t get_name (char (&)[32] out_name)
Defined at line 240 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t set_name (const char * name, size_t len)
Defined at line 245 of file ../../zircon/kernel/object/process_dispatcher.cc
uintptr_t vdso_code_address ()
return a cached copy of the vdso code address or compute a new one
Defined at line 267 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
VmAspace * restricted_aspace ()
Returns the "restricted" address space for a process, or nullptr if it does not have a
restricted address space.
The restricted address space spans the bottom half of the process' total address space, and is
private to the process. Threads executing in restricted mode are restricted to this address
space.
Defined at line 289 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
zx_status_t Start (fbl::RefPtr<ThreadDispatcher>thread,zx_vaddr_tpc,zx_vaddr_tsp,HandleOwnerarg_handle,uintptr_targ2)
Defined at line 1093 of file ../../zircon/kernel/object/process_dispatcher.cc
void Kill (int64_t retcode)
Defined at line 339 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t Suspend ()
Suspends the process.
Suspending a process causes all child threads to suspend as well as any new children
that are added until the process is resumed. Suspend() is cumulative, so the process
will only resume once Resume() has been called an equal number of times.
Returns ZX_OK on success, or ZX_ERR_BAD_STATE iff the process is dying or dead.
Defined at line 380 of file ../../zircon/kernel/object/process_dispatcher.cc
void Resume ()
Defined at line 406 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_info_process_t GetInfo ()
Syscall helpers
Defined at line 610 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t GetStats (zx_info_task_stats_t * stats)
Defined at line 650 of file ../../zircon/kernel/object/process_dispatcher.cc
TaskRuntimeStats GetTaskRuntimeStats ()
Get the runtime of all threads that previously ran or are currently running under this process.
Defined at line 728 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t GetAspaceMaps (VmarMapsInfoWriter &maps,size_tmax,size_t *actual,size_t *available)
Defined at line 739 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t GetVmos (VmoInfoWriter &vmos,size_tmax,size_t *actual,size_t *available)
Defined at line 773 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t GetThreads (fbl::Array<zx_koid_t> * threads)
Defined at line 815 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t SetCriticalToJob (fbl::RefPtr<JobDispatcher> critical_to_job, bool retcode_nonzero)
Defined at line 833 of file ../../zircon/kernel/object/process_dispatcher.cc
bool CriticalToRootJob ()
Defined at line 605 of file ../../zircon/kernel/object/process_dispatcher.cc
Exceptionate * exceptionate ()
Defined at line 859 of file ../../zircon/kernel/object/process_dispatcher.cc
Exceptionate * debug_exceptionate ()
Defined at line 864 of file ../../zircon/kernel/object/process_dispatcher.cc
uint32_t ThreadCount ()
The following two methods can be slow and inaccurate and should only be
called from diagnostics code.
Defined at line 869 of file ../../zircon/kernel/object/process_dispatcher.cc
VmObject::AttributionCounts GetAttributedMemory ()
Defined at line 876 of file ../../zircon/kernel/object/process_dispatcher.cc
fbl::RefPtr<ProcessDispatcher> LookupProcessById (zx_koid_t koid)
Look up a process given its koid.
Returns nullptr if not found.
Defined at line 923 of file ../../zircon/kernel/object/process_dispatcher.cc
fbl::RefPtr<ThreadDispatcher> LookupThreadById (zx_koid_t koid)
Look up a thread in this process given its koid.
Returns nullptr if not found.
Defined at line 929 of file ../../zircon/kernel/object/process_dispatcher.cc
uintptr_t get_debug_addr ()
Defined at line 938 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t set_debug_addr (uintptr_t addr)
Defined at line 943 of file ../../zircon/kernel/object/process_dispatcher.cc
uintptr_t get_dyn_break_on_load ()
Defined at line 949 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t set_dyn_break_on_load (uintptr_t break_on_load)
Defined at line 954 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t EnforceBasicPolicy (uint32_t condition)
Checks |condition| and enforces the parent job's policy.
Depending on the parent job's policy, this method may signal an exception
on the calling thread or signal that the current process should be
killed.
Must be called by syscalls before performing an action represented by an
ZX_POL_xxxxx condition. If the return value is ZX_OK the action can
proceed; otherwise, the process is not allowed to perform the action,
and the status value should be returned to the usermode caller.
E.g., in sys_channel_create:
auto up = ProcessDispatcher::GetCurrent();
zx_status_t res = up->EnforceBasicPolicy(ZX_POL_NEW_CHANNEL);
if (res != ZX_OK) {
// Channel creation denied by the calling process's
// parent job's policy.
return res;
}
// Ok to create a channel.
Defined at line 960 of file ../../zircon/kernel/object/process_dispatcher.cc
TimerSlack GetTimerSlackPolicy ()
Returns this job's timer slack policy.
Defined at line 987 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t MakeAndAddHandle (fbl::RefPtr<Dispatcher>dispatcher,zx_rights_trights,zx_handle_t *out)
Allocates a handle with the given rights to the given dispatcher. The handle is added to the
calling process' handle table, and its value is returned in out.
Defined at line 1061 of file ../../zircon/kernel/object/process_dispatcher.cc
zx_status_t MakeAndAddHandle (KernelHandle<Dispatcher>kernel_handle,zx_rights_trights,zx_handle_t *out)
Allocates a handle with the given rights to the dispatcher enclosed in the given kernel handle.
The handle is added to the calling process' handle table, and its value is returned in out.
Defined at line 1079 of file ../../zircon/kernel/object/process_dispatcher.cc
void OnUserExceptionForJobDebugger (ThreadDispatcher * t, const arch_exception_context_t * context)
Dispatch a user exception to job debugger exception channels.
Defined at line 1029 of file ../../zircon/kernel/object/process_dispatcher.cc
Enumerations
enum class State
| Name | Value | Comments |
|---|---|---|
| INITIAL | 0 |
initial state, no thread present in process |
| RUNNING | 1 |
first thread has started and is running |
| DYING | 2 |
process has delivered kill signal to all threads |
| DEAD | 3 |
all threads have entered DEAD state and potentially dropped refs on process |
state of the process
Defined at line 101 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
enum class SharedAspaceType
| Name | Value | Comments |
|---|---|---|
| New | 0 |
Top half: a new shareable address space |
| Shared | 1 |
Top half: shared address space from another process |
The type of address space used to initialize a ProcessDispatcher for a shared process.
Defined at line 109 of file ../../zircon/kernel/object/include/object/process_dispatcher.h
Friends
class ThreadDispatcher
void ProcessDispatcher (const char * prefix, size_t min_bytes)
void ProcessDispatcher (zx_koid_t id)
void ProcessDispatcher ()
template <typename T>
void ProcessDispatcher (const T * restricted_state_source, zx_restricted_reason_t reason)
void ProcessDispatcher (RestrictedState * rs, const zx_exception_report_t & report)
zx_status_t ProcessDispatcher (uintptr_t vector_table_ptruintptr_t context)