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_view name, uint32_t flags, KernelHandle<ProcessDispatcher> * handle, zx_rights_t * rights, KernelHandle<VmAddressRegionDispatcher> * root_vmar_handle, zx_rights_t * root_vmar_rights)

Defined at line 79 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_view name, uint32_t flags, 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 130 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 205 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 222 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_koid_t get_related_koid ()

Defined at line 511 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 249 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 267 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 1043 of file ../../zircon/kernel/object/process_dispatcher.cc

State state ()

Defined at line 513 of file ../../zircon/kernel/object/process_dispatcher.cc

fbl::RefPtr<JobDispatcher> job ()

Defined at line 518 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_status_t get_name (char (&)[32] out_name)

Defined at line 239 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_status_t set_name (const char * name, size_t len)

Defined at line 244 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_t pc, zx_vaddr_t sp, HandleOwner arg_handle, uintptr_t arg2)

Defined at line 1092 of file ../../zircon/kernel/object/process_dispatcher.cc

void Kill (int64_t retcode)

Defined at line 338 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 379 of file ../../zircon/kernel/object/process_dispatcher.cc

void Resume ()

Defined at line 405 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_info_process_t GetInfo ()

Syscall helpers

Defined at line 609 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_status_t GetStats (zx_info_task_stats_t * stats)

Defined at line 649 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 727 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_status_t GetAspaceMaps (VmarMapsInfoWriter & maps, size_t max, size_t * actual, size_t * available)

Defined at line 738 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_status_t GetVmos (VmoInfoWriter & vmos, size_t max, size_t * actual, size_t * available)

Defined at line 772 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_status_t GetThreads (fbl::Array<zx_koid_t> * threads)

Defined at line 814 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_status_t SetCriticalToJob (fbl::RefPtr<JobDispatcher> critical_to_job, bool retcode_nonzero)

Defined at line 832 of file ../../zircon/kernel/object/process_dispatcher.cc

bool CriticalToRootJob ()

Defined at line 604 of file ../../zircon/kernel/object/process_dispatcher.cc

Exceptionate * exceptionate ()

Defined at line 858 of file ../../zircon/kernel/object/process_dispatcher.cc

Exceptionate * debug_exceptionate ()

Defined at line 863 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 868 of file ../../zircon/kernel/object/process_dispatcher.cc

VmObject::AttributionCounts GetAttributedMemory ()

Defined at line 875 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 922 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 928 of file ../../zircon/kernel/object/process_dispatcher.cc

uintptr_t get_debug_addr ()

Defined at line 937 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_status_t set_debug_addr (uintptr_t addr)

Defined at line 942 of file ../../zircon/kernel/object/process_dispatcher.cc

uintptr_t get_dyn_break_on_load ()

Defined at line 948 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_status_t set_dyn_break_on_load (uintptr_t break_on_load)

Defined at line 953 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 959 of file ../../zircon/kernel/object/process_dispatcher.cc

TimerSlack GetTimerSlackPolicy ()

Returns this job's timer slack policy.

Defined at line 986 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_status_t MakeAndAddHandle (fbl::RefPtr<Dispatcher> dispatcher, zx_rights_t rights, 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 1060 of file ../../zircon/kernel/object/process_dispatcher.cc

zx_status_t MakeAndAddHandle (KernelHandle<Dispatcher> kernel_handle, zx_rights_t rights, 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 1078 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 1028 of file ../../zircon/kernel/object/process_dispatcher.cc

Enumerations

enum State
Name Value
INITIAL 0
RUNNING 1
DYING 2
DEAD 3

state of the process

Defined at line 101 of file ../../zircon/kernel/object/include/object/process_dispatcher.h

enum SharedAspaceType
Name Value
New 0
Shared 1

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)
zx_status_t ProcessDispatcher (uintptr_t vector_table_ptruintptr_t context)