The Pedigree Project 0.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
Process Class Reference

#include <Process.h>

+ Inheritance diagram for Process:
+ Collaboration diagram for Process:

Classes

struct  ChildTransition
 
class  ControllingTerminal
 
struct  DeferredPublication
 
class  ExecScope
 
class  FileContextLease
 
class  FilesystemAccessScope
 
struct  ProcessMetadata
 
class  ReaperClaim
 
class  TerminalOwnerReservation
 
class  ThreadCreationScope
 
class  ThreadLease
 
struct  UserReservationSnapshot
 
class  VforkCompletion
 

Public Types

enum  ProcessType { Stock , Posix }
 
enum  ProcessState {
  Active , Suspended , Terminating , Terminated ,
  Reaped
}
 
enum class  ChildTransitionKind { None , Stopped , Continued }
 
enum class  FilesystemContextMode { Inherit , Deferred }
 
enum class  UserRegion { Normal , Dynamic }
 

Public Member Functions

 Process ()
 
 Process (Process *pParent, bool bCopyOnWrite=true)
 
virtual ~Process ()
 
size_t addThread (Thread *pThread)
 
void threadExiting (Thread *pThread)
 
void transferExecProcessSignals (Thread *pThread)
 
void removeThread (Thread *pThread)
 
size_t getNumThreads ()
 
MUST_USE_RESULT bool acquireThread (ThreadLease &lease, size_t n)
 
MUST_USE_RESULT bool acquireProcessSignalThread (ThreadLease &lease)
 
MUST_USE_RESULT bool acquireThreadById (ThreadLease &lease, size_t id)
 
MUST_USE_RESULT bool acquireThreadByTaskId (ThreadLease &lease, size_t id)
 
MUST_USE_RESULT bool acquireThreadByUserspaceId (ThreadLease &lease, size_t id, const UserspacePidNamespace *space)
 
MUST_USE_RESULT bool acquireThread (ThreadLease &lease, Thread *expected)
 
TerminalOwnerReservation reserveTerminalOwner ()
 
size_t getId ()
 
size_t getUserspaceId () const
 
size_t getUserspaceId (const UserspacePidNamespace *space) const
 
SharedPointer< UserspacePidNamespace > pidNamespace () const
 
SharedPointer< UserspacePid > pidIdentity () const
 
SharedPointer< UserspacePidNamespace > pidNamespaceForChildren ()
 
bool createPidNamespace ()
 
bool unsharePidNamespace ()
 
bool unsharePidNamespace (const SharedPointer< UserspacePidNamespace > &prepared)
 
bool pidNamespaceReady () const
 
LargeStaticString & description ()
 
VirtualAddressSpace * getAddressSpace ()
 
Process * addressSpaceOwner ()
 
bool isVforkChild () const
 
void borrowVforkAddressSpace (Process &parent, const SharedPointer< VforkCompletion > &completion)
 
void releaseVforkAddressSpace ()
 
void setExitStatus (int code)
 
int getExitStatus ()
 
void reap ()
 
bool prepareThreadExit ()
 
bool beginTermination (int code=0, Subsystem::ExitCause cause=Subsystem::ExitCause::Normal)
 
bool quiesceTermination ()
 
void finishTermination (bool notifyParent=false) NORETURN
 
ReaperClaim tryClaimReaper ()
 
void kill () NORETURN
 
void suspend (int stopSignal=0)
 
void suspendIfContinuationEpoch (int stopSignal, size_t continuationEpoch)
 
void resume ()
 
size_t getContinuationEpoch ()
 
Process * getParent ()
 
FilesystemContextRef acquireFilesystemContext () const
 
MUST_USE_RESULT bool installFilesystemContext (FilesystemContextOwner &&context)
 
bool replaceFilesystemContext (FilesystemContextOwner &&replacement, const FilesystemContextRef &expected)
 
bool filesystemContextReady () const
 
void releaseFilesystemContext ()
 
SharedPointer< ControllingTerminal > acquireCttyContext () const
 
MUST_USE_RESULT File * acquireCtty (FileContextLease &lease) const
 
void setCttyContext (const SharedPointer< ControllingTerminal > &context)
 
MUST_USE_RESULT bool setCtty (File *file)
 
bool snapshotUserReservations (UserReservationSnapshot &result)
 
bool commitUserReservations (uint64_t expectedGeneration, UserReservationSnapshot &replacement)
 
bool allocateUserRange (UserRegion region, size_t length, uintptr_t &address)
 
bool allocateSpecificUserRange (UserRegion region, uintptr_t address, size_t length)
 
void freeUserRange (UserRegion region, uintptr_t address, size_t length)
 
void resetUserReservations ()
 
virtual bool snapshotFilesystemCredentials (const Thread *task, FilesystemCredentials &out) const
 
void inheritFilesystemIds (Thread &child, const Thread *creator) const
 
virtual bool installUserIdentity (User *, Group *, const uint32_t *groups, size_t count)
 
User * getUser () const
 
void setUser (User *pUser)
 
User * getEffectiveUser () const
 
void setEffectiveUser (User *pUser)
 
Group * getGroup () const
 
void setGroup (Group *pGroup)
 
Group * getEffectiveGroup () const
 
void setEffectiveGroup (Group *pGroup)
 
virtual int64_t getUserId () const
 
virtual int64_t getGroupId () const
 
virtual int64_t getEffectiveUserId () const
 
virtual int64_t getEffectiveGroupId () const
 
virtual void getSupplementalGroupIds (Vector< int64_t > &vec) const
 
virtual void setUserId (int64_t id)
 
virtual void setGroupId (int64_t id)
 
virtual void setEffectiveUserId (int64_t id)
 
virtual void setEffectiveGroupId (int64_t id)
 
void setLinker (DynamicLinker *pDl)
 
DynamicLinker * getLinker ()
 
void setSubsystem (Subsystem *pSubsystem)
 
Subsystem * getSubsystem ()
 
ProcessType getType () const
 
WaitQueue::Guard acquireChildStateWait ()
 
bool waitUntilTerminationReapable ()
 
bool waitUntilTerminationReapableForTerminalCoordinator ()
 
bool selectPendingChildTransition (bool includeStopped, bool includeContinued, bool consume, ChildTransition &transition)
 
bool takePendingChildTransition (bool includeStopped, bool includeContinued, ChildTransition &transition)
 
ProcessState getState () const
 
bool isSuspended ()
 
void markTerminating ()
 
void trackHeap (ssize_t nBytes)
 
void trackPages (ssize_t nVirtual, ssize_t nPhysical, ssize_t nShared)
 
void resetCounts ()
 
Time::Timestamp getUserTime () const
 
Time::Timestamp getKernelTime () const
 
Time::Timestamp getReapedChildrenUserTime () const
 
Time::Timestamp getReapedChildrenKernelTime () const
 
void accountReapedChild (const Process *child, Time::Timestamp &user, Time::Timestamp &kernel)
 
Time::Timestamp getStartTime () const
 
ssize_t getHeapUsage () const
 
ssize_t getVirtualPageCount () const
 
ssize_t getPhysicalPageCount () const
 
ssize_t getSharedPageCount () const
 
bool hasSharedAddressSpace () const
 

Static Public Member Functions

static SharedPointer< UserspacePidNamespace > rootPidNamespace ()
 
static bool currentFilesystemCredentials (FilesystemCredentials &out)
 
static Process * getInit ()
 
static void setInit (Process *pProcess)
 

Protected Member Functions

void publishAccountIdentity (User *, Group *)
 
 Process (DeferredPublication, ProcessType type=Stock)
 
 Process (DeferredPublication, Process *pParent, bool bCopyOnWrite=true, FilesystemContextMode filesystemContext=FilesystemContextMode::Inherit, bool emptyAddressSpace=false, ProcessType type=Stock)
 
void publish ()
 
void prepareForDestruction ()
 
void enableTimeAccountingReports (size_t initialInterest=~size_t(0))
 
void setTimeAccountingReportInterest (size_t interest, bool enabled)
 

Static Protected Member Functions

static bool loadFilesystemIds (const Thread &, uint32_t &uid, uint32_t &gid)
 
static void publishFilesystemIds (Thread &, uint32_t uid, uint32_t gid)
 

Protected Attributes

Spinlock m_CredentialLock
 

Private Types

enum  ReaperState { ReaperUnclaimed , ReaperClaimed , ReaperPublished }
 

Private Member Functions

void finishTermination (bool abandonStack, bool notifyParent) NORETURN
 
 Process (const Process &)
 
Process & operator= (const Process &)
 
virtual void reportTimesUpdated (Time::Timestamp userTotal, Time::Timestamp total)
 
void drainDeferredTimeAccounting ()
 
void closeDeferredTimeAccounting ()
 
Time::Timestamp totalTime (CpuTimeMode mode) const
 
ALWAYS_INLINE void reportTimeAccounting (Time::Timestamp elapsed)
 
void queueTimeAccountingReport (Time::Timestamp elapsed)
 
virtual void processTerminated ()
 
bool transitionState (ProcessState expected, ProcessState desired)
 
void suspendInternal (int stopSignal, bool checkContinuationEpoch, size_t continuationEpoch)
 
void transitionToTerminating ()
 
bool terminatingThreadReapable (Thread *pThread, bool &wakeOwner)
 
void publishTerminationStatus (bool notifyParent)
 
void publishTerminationReapable ()
 
void publishReaperClaim ()
 
bool beginThreadJoin ()
 
void endThreadJoin ()
 
bool beginExternalLease ()
 
void endExternalLease ()
 
void closeExternalLeaseAdmission ()
 
void drainExternalLeases ()
 
void releaseThreadLease (Thread *thread)
 
void installTerminalOwner (Thread *owner)
 

Private Attributes

Vector< Thread * > m_Threads
 
Atomic< size_t > m_NextTid
 
size_t m_Id
 
SharedPointer< UserspacePidNamespace > m_UserspaceNamespace
 
SharedPointer< UserspacePid > m_UserspacePid
 
SharedPointer< UserspacePidNamespace > m_ChildrenPidNamespace
 
LargeStaticString str
 
Process * m_pParent
 
VirtualAddressSpace * m_pAddressSpace
 
VirtualAddressSpace * m_pVforkPrivateAddressSpace = nullptr
 
Process * m_pVforkOwner = nullptr
 
SharedPointer< VforkCompletion > m_VforkCompletion
 
int m_ExitStatus
 
Mutex m_FilesystemContextLock
 
FilesystemContextOwner m_FilesystemContext
 
bool m_bFilesystemContextReady
 
SharedPointer< ControllingTerminal > m_Ctty
 
MemoryAllocator m_SpaceAllocator
 
MemoryAllocator m_DynamicSpaceAllocator
 
Spinlock m_UserReservationLock
 
uint64_t m_UserReservationGeneration
 
FilesystemCredentials m_NativeFilesystemCredentials
 
User * m_pUser
 
Group * m_pGroup
 
User * m_pEffectiveUser
 
Group * m_pEffectiveGroup
 
DynamicLinker * m_pDynamicLinker
 
Subsystem * m_pSubsystem
 
WaitQueue m_ChildStateWaiters
 
WaitQueue m_TerminationWaiters
 
WaitQueue m_SuspensionWaiters
 
size_t m_ContinuationEpoch
 
WaitQueue m_ThreadJoinWaiters
 
size_t m_nThreadJoinOperations
 
bool m_bThreadJoinAdmissionClosed
 
Spinlock m_ExternalLeaseLock
 
WaitQueue m_ExternalLeaseWaiters
 
size_t m_nExternalLeases
 
bool m_bExternalLeaseAdmissionClosed
 
bool m_bExternalLeaseReleaseInProgress
 
ChildTransition m_PendingChildTransition
 
ProcessState m_State
 
const ProcessType m_Type
 
bool m_bDestroying
 
bool m_bPublished
 
bool m_bUnregistered
 
Thread * m_pTerminatingThread
 
Thread * m_pExecOwner = nullptr
 
bool m_bExecCommitted = false
 
bool m_bExecExitForwarded = false
 
size_t m_nThreadCreations = 0
 
WaitQueue m_ExecWaiters
 
size_t m_nTerminationParticipants
 
bool m_bTerminationRendezvousStarted
 
bool m_bTerminalOwnerReserved
 
Thread * m_pReservedTerminalOwner
 
bool m_bTerminationCleanupStarted
 
bool m_bTerminationSealed
 
bool m_bTerminationReapable
 
size_t m_ReaperState
 
Spinlock m_Lock
 
Spinlock m_TimeAccountingLock
 
struct Process::ProcessMetadata m_Metadata
 
DeferredTimeAccounting m_DeferredTimeAccounting
 
OperationBarrier m_TimeAccountingReports
 
OperationBarrier m_DeferredThreadReaps
 
bool m_bTimeAccountingReportsEnabled
 
size_t m_TimeAccountingReportInterest
 
bool m_bSharedAddressSpace
 

Static Private Attributes

static Process * m_pInitProcess = 0
 

Friends

class PerProcessorScheduler
 
class Scheduler
 
class Thread
 
class ZombieProcess
 
class ZombieQueue
 

Detailed Description

An abstraction of a Process - a container for one or more threads all running in the same address space.

Definition at line 109 of file Process.h.

Member Enumeration Documentation

◆ ChildTransitionKind

enum class Process::ChildTransitionKind
strong

Definition at line 564 of file Process.h.

◆ FilesystemContextMode

enum class Process::FilesystemContextMode
strong

Definition at line 624 of file Process.h.

◆ ProcessState

Processes have their own state, aside from the state of their threads. These states are very general and don't reflect the current scheduling state of the process as a whole in intricate detail.

Enumerator
Reaped 

Terminal wait status is visible; the owner may still be on-stack.

Definition at line 303 of file Process.h.

◆ ProcessType

Subsystems may inherit Process to provide custom functionality. However, they need to know whether a Process pointer is subsystem-specific. This enumeration is designed to allow functions using Process objects in subsystems with inherited Process objects to be able to figure out what type the Process is without depending on any external accounting.

Definition at line 296 of file Process.h.

◆ ReaperState

enum Process::ReaperState
private

Definition at line 1194 of file Process.h.

◆ UserRegion

enum class Process::UserRegion
strong

Definition at line 646 of file Process.h.

Constructor & Destructor Documentation

◆ Process() [1/4]

Process::Process ( )

Default constructor.

Definition at line 494 of file Process.cc.

References publish().

◆ Process() [2/4]

Process::Process ( Process *  pParent,
bool  bCopyOnWrite = true 
)

Constructor for creating a new Process. Creates a new Process as a UNIX fork() would, from the given parent process. This constructor does not create any threads.

Parameters
pParentThe parent process.
bCopyOnWriteWhether to mark the address space copy-on-write (default) or to share it read/write with the new child.

Definition at line 564 of file Process.cc.

References publish().

◆ ~Process()

Process::~Process ( )
virtual

◆ Process() [3/4]

Process::Process ( DeferredPublication  ,
ProcessType  type = Stock 
)
protected

Definition at line 498 of file Process.cc.

◆ Process() [4/4]

Process::Process ( DeferredPublication  ,
Process *  pParent,
bool  bCopyOnWrite = true,
FilesystemContextMode  filesystemContext = FilesystemContextMode::Inherit,
bool  emptyAddressSpace = false,
ProcessType  type = Stock 
)
protected

Definition at line 569 of file Process.cc.

Member Function Documentation

◆ accountReapedChild()

void Process::accountReapedChild ( const Process *  child,
Time::Timestamp &  user,
Time::Timestamp &  kernel 
)

Adds a reaped child's final self and descendant CPU totals to this process. The caller must own the child's sole reaper claim and wait until it is termination-reapable before calling this exactly once.

Definition at line 857 of file Process.cc.

References getUserTime(), Reaped, Process::ProcessMetadata::reapedChildrenKernelTime, and Process::ProcessMetadata::reapedChildrenUserTime.

◆ acquireChildStateWait()

WaitQueue::Guard Process::acquireChildStateWait ( )
inline

Serialises child-state inspection with blocking and with other waiters.

Definition at line 736 of file Process.h.

◆ acquireCtty()

File * Process::acquireCtty ( FileContextLease &  lease) const

Definition at line 800 of file Process.cc.

◆ acquireCttyContext()

SharedPointer< Process::ControllingTerminal > Process::acquireCttyContext ( ) const

Definition at line 795 of file Process.cc.

◆ acquireFilesystemContext()

FilesystemContextRef Process::acquireFilesystemContext ( ) const

Definition at line 729 of file Process.cc.

◆ acquireProcessSignalThread()

bool Process::acquireProcessSignalThread ( ThreadLease &  lease)

◆ acquireThread() [1/2]

bool Process::acquireThread ( ThreadLease &  lease,
size_t  n 
)

Pins the n'th thread in this process into lease. Any previous lease is released; failure leaves lease empty.

Definition at line 1385 of file Process.cc.

References beginExternalLease(), Thread::beginExternalLease(), Vector< T >::count(), endExternalLease(), m_Lock, and m_Threads.

Referenced by MemoryPressureProcessKiller::compact(), PosixSubsystem::prepareThreadsForExec(), PosixSubsystem::queueSignalDelivery(), resume(), and PosixSubsystem::setSignalHandler().

+ Here is the caller graph for this function:

◆ acquireThread() [2/2]

bool Process::acquireThread ( ThreadLease &  lease,
Thread *  expected 
)

Pins an expected Thread into lease if this Process still owns it. Any previous lease is released; failure leaves lease empty.

Definition at line 1528 of file Process.cc.

References Vector< T >::begin(), beginExternalLease(), Thread::beginExternalLease(), Vector< T >::end(), endExternalLease(), m_Lock, and m_Threads.

◆ acquireThreadById()

bool Process::acquireThreadById ( ThreadLease &  lease,
size_t  id 
)

Pins the thread whose process-local identifier is id into lease. Any previous lease is released; failure leaves lease empty.

Definition at line 1446 of file Process.cc.

References Vector< T >::begin(), beginExternalLease(), Thread::beginExternalLease(), Vector< T >::end(), endExternalLease(), m_Lock, and m_Threads.

◆ acquireThreadByTaskId()

bool Process::acquireThreadByTaskId ( ThreadLease &  lease,
size_t  id 
)

Definition at line 1473 of file Process.cc.

◆ acquireThreadByUserspaceId()

bool Process::acquireThreadByUserspaceId ( ThreadLease &  lease,
size_t  id,
const UserspacePidNamespace *  space 
)

Definition at line 1500 of file Process.cc.

◆ addressSpaceOwner()

Process * Process::addressSpaceOwner ( )
inline

The waiting creator keeps this owner and its image alive until detach.

Definition at line 545 of file Process.h.

Referenced by X64PreparedPageRemap::commit().

+ Here is the caller graph for this function:

◆ addThread()

size_t Process::addThread ( Thread *  pThread)

◆ allocateSpecificUserRange()

bool Process::allocateSpecificUserRange ( UserRegion  region,
uintptr_t  address,
size_t  length 
)

Definition at line 132 of file Process-reservations.cc.

◆ allocateUserRange()

bool Process::allocateUserRange ( UserRegion  region,
size_t  length,
uintptr_t &  address 
)

Definition at line 101 of file Process-reservations.cc.

◆ beginExternalLease()

bool Process::beginExternalLease ( )
private

◆ beginTermination()

bool Process::beginTermination ( int  code = 0,
Subsystem::ExitCause  cause = Subsystem::ExitCause::Normal 
)

◆ beginThreadJoin()

bool Process::beginThreadJoin ( )
private

Pins this Process and its retained Thread objects for Thread::join.

Definition at line 1178 of file Process.cc.

References m_bThreadJoinAdmissionClosed, m_nThreadJoinOperations, and m_ThreadJoinWaiters.

Referenced by Thread::detach(), Thread::joinInternal(), and Thread::startDetached().

+ Here is the caller graph for this function:

◆ borrowVforkAddressSpace()

void Process::borrowVforkAddressSpace ( Process &  parent,
const SharedPointer< VforkCompletion > &  completion 
)

Definition at line 702 of file Process.cc.

◆ closeDeferredTimeAccounting()

void Process::closeDeferredTimeAccounting ( )
private

Stops timer-report admission and discards any unpublished residue.

Definition at line 938 of file Process.cc.

References OperationBarrier::closeAndWait(), m_bTimeAccountingReportsEnabled, m_DeferredTimeAccounting, m_TimeAccountingReports, and DeferredTimeAccounting::take().

Referenced by beginTermination(), and prepareForDestruction().

+ Here is the caller graph for this function:

◆ closeExternalLeaseAdmission()

void Process::closeExternalLeaseAdmission ( )
private

Prevents any further ProcessLease or ThreadLease acquisition.

Definition at line 1273 of file Process.cc.

References m_bExternalLeaseAdmissionClosed, and m_ExternalLeaseLock.

Referenced by prepareForDestruction(), and Scheduler::removeProcess().

+ Here is the caller graph for this function:

◆ commitUserReservations()

bool Process::commitUserReservations ( uint64_t  expectedGeneration,
UserReservationSnapshot &  replacement 
)

A successful swap leaves old storage in replacement for unlocked destruction.

Definition at line 86 of file Process-reservations.cc.

References commitUserReservations(), m_DynamicSpaceAllocator, m_SpaceAllocator, and RangeList< T, Reversed >::swap().

Referenced by commitUserReservations().

+ Here is the caller graph for this function:

◆ createPidNamespace()

bool Process::createPidNamespace ( )

Definition at line 106 of file Process.cc.

◆ currentFilesystemCredentials()

bool Process::currentFilesystemCredentials ( FilesystemCredentials &  out)
static

Definition at line 47 of file Process-credentials.cc.

◆ description()

LargeStaticString & Process::description ( )
inline

Returns the description string of this process.

Definition at line 525 of file Process.h.

Referenced by PosixSubsystem::invoke(), and Rtc::processElapsedTime().

+ Here is the caller graph for this function:

◆ drainDeferredTimeAccounting()

void Process::drainDeferredTimeAccounting ( )
private

Drains one coalesced batch from an ordinary accounting worker.

Definition at line 925 of file Process.cc.

References getUserTime(), m_DeferredTimeAccounting, m_TimeAccountingReports, reportTimesUpdated(), DeferredTimeAccounting::take(), and OperationBarrier::tryAcquire().

Referenced by Scheduler::drainDeferredTimeAccounting().

+ Here is the caller graph for this function:

◆ drainExternalLeases()

void Process::drainExternalLeases ( )
private

Waits until all leases admitted before closure have left scope.

Definition at line 1278 of file Process.cc.

References m_bExternalLeaseAdmissionClosed, m_bExternalLeaseReleaseInProgress, m_ExternalLeaseLock, m_ExternalLeaseWaiters, and m_nExternalLeases.

Referenced by prepareForDestruction().

+ Here is the caller graph for this function:

◆ enableTimeAccountingReports()

void Process::enableTimeAccountingReports ( size_t  initialInterest = ~size_t(0))
protected

Enables deferred timer reporting for a derived process type.

Definition at line 839 of file Process.cc.

References m_bTimeAccountingReportsEnabled.

Referenced by PosixProcess::PosixProcess().

+ Here is the caller graph for this function:

◆ endExternalLease()

void Process::endExternalLease ( )
private

◆ endThreadJoin()

void Process::endThreadJoin ( )
private

Releases a successful beginThreadJoin admission.

Definition at line 1188 of file Process.cc.

References Dec, m_Id, m_nThreadJoinOperations, and m_ThreadJoinWaiters.

Referenced by Thread::detach(), Thread::discardJoin(), Thread::joinInternal(), and Thread::startDetached().

+ Here is the caller graph for this function:

◆ filesystemContextReady()

bool Process::filesystemContextReady ( ) const

Definition at line 764 of file Process.cc.

◆ finishTermination() [1/2]

void Process::finishTermination ( bool  abandonStack,
bool  notifyParent 
)
private

Definition at line 1929 of file Process.cc.

◆ finishTermination() [2/2]

void Process::finishTermination ( bool  notifyParent = false)

Completes an elected teardown and retires the current thread.

Definition at line 1925 of file Process.cc.

References finishTermination().

Referenced by PosixSubsystem::exit(), finishTermination(), and kill().

+ Here is the caller graph for this function:

◆ freeUserRange()

void Process::freeUserRange ( UserRegion  region,
uintptr_t  address,
size_t  length 
)

Definition at line 161 of file Process-reservations.cc.

◆ getAddressSpace()

VirtualAddressSpace * Process::getAddressSpace ( )
inline

◆ getContinuationEpoch()

size_t Process::getContinuationEpoch ( )

Snapshots the generation invalidated by every process continuation.

Definition at line 2150 of file Process.cc.

References m_ContinuationEpoch, and m_SuspensionWaiters.

◆ getEffectiveGroup()

Group * Process::getEffectiveGroup ( ) const

Gets the current effective group.

Definition at line 122 of file Process-credentials.cc.

References m_pEffectiveGroup.

◆ getEffectiveGroupId()

int64_t Process::getEffectiveGroupId ( ) const
virtual

Definition at line 2253 of file Process.cc.

◆ getEffectiveUser()

User * Process::getEffectiveUser ( ) const

Gets the effective user.

Definition at line 112 of file Process-credentials.cc.

References m_pEffectiveUser.

◆ getEffectiveUserId()

int64_t Process::getEffectiveUserId ( ) const
virtual

Definition at line 2248 of file Process.cc.

◆ getExitStatus()

int Process::getExitStatus ( )
inline

Gets the exit status of the process.

Definition at line 560 of file Process.h.

Referenced by PosixSubsystem::queueSignalDelivery().

+ Here is the caller graph for this function:

◆ getGroup()

Group * Process::getGroup ( ) const

Gets the current group.

Definition at line 117 of file Process-credentials.cc.

References m_pGroup.

Referenced by ProcFs::addProcess().

+ Here is the caller graph for this function:

◆ getGroupId()

int64_t Process::getGroupId ( ) const
virtual

Definition at line 2243 of file Process.cc.

◆ getHeapUsage()

ssize_t Process::getHeapUsage ( ) const
inline

Get process usage.

Definition at line 902 of file Process.h.

Referenced by Rtc::processElapsedTime().

+ Here is the caller graph for this function:

◆ getId()

size_t Process::getId ( )
inline

◆ getInit()

Process * Process::getInit ( )
static

Get the init process (first userspace process, parent of all userspace processes).

Definition at line 2417 of file Process.cc.

References m_pInitProcess.

◆ getKernelTime()

Time::Timestamp Process::getKernelTime ( ) const
inline

Definition at line 832 of file Process.h.

◆ getLinker()

DynamicLinker * Process::getLinker ( )
inline

Definition at line 717 of file Process.h.

◆ getNumThreads()

size_t Process::getNumThreads ( )

◆ getParent()

Process * Process::getParent ( )
inline

◆ getPhysicalPageCount()

ssize_t Process::getPhysicalPageCount ( ) const
inline

Definition at line 908 of file Process.h.

◆ getReapedChildrenKernelTime()

Time::Timestamp Process::getReapedChildrenKernelTime ( ) const
inline

Definition at line 838 of file Process.h.

◆ getReapedChildrenUserTime()

Time::Timestamp Process::getReapedChildrenUserTime ( ) const
inline

Definition at line 835 of file Process.h.

◆ getSharedPageCount()

ssize_t Process::getSharedPageCount ( ) const
inline

Definition at line 911 of file Process.h.

◆ getStartTime()

Time::Timestamp Process::getStartTime ( ) const
inline

Definition at line 897 of file Process.h.

◆ getState()

ProcessState Process::getState ( ) const
inline

Definition at line 764 of file Process.h.

◆ getSubsystem()

Subsystem * Process::getSubsystem ( )
inline

Definition at line 725 of file Process.h.

◆ getSupplementalGroupIds()

void Process::getSupplementalGroupIds ( Vector< int64_t > &  vec) const
virtual

Definition at line 2258 of file Process.cc.

◆ getType()

ProcessType Process::getType ( ) const
inline

Definition at line 729 of file Process.h.

◆ getUser()

User * Process::getUser ( ) const

Gets the current user.

Definition at line 107 of file Process-credentials.cc.

Referenced by ProcFs::addProcess(), and getUserId().

+ Here is the caller graph for this function:

◆ getUserId()

int64_t Process::getUserId ( ) const
virtual

Direct, overrideable ways to get IDs (redirects to User/Group interface by default)

Reimplemented in PosixProcess.

Definition at line 2238 of file Process.cc.

References getUser().

Referenced by PosixSubsystem::invoke(), and PosixSubsystem::queueSignalDelivery().

+ Here is the caller graph for this function:

◆ getUserspaceId() [1/2]

size_t Process::getUserspaceId ( ) const
inline

Returns the process ID exposed to userspace.

Definition at line 504 of file Process.h.

Referenced by ProcFs::addProcess(), beginTermination(), Thread::getUserspaceTaskId(), PosixSubsystem::invoke(), publish(), PosixSubsystem::queueSignalDelivery(), and PosixSubsystem::threadExiting().

+ Here is the caller graph for this function:

◆ getUserspaceId() [2/2]

size_t Process::getUserspaceId ( const UserspacePidNamespace *  space) const
inline

Definition at line 508 of file Process.h.

◆ getUserTime()

Time::Timestamp Process::getUserTime ( ) const
inline

Gets timestamps.

Definition at line 829 of file Process.h.

Referenced by accountReapedChild(), drainDeferredTimeAccounting(), and PosixSubsystem::queueSignalDelivery().

+ Here is the caller graph for this function:

◆ getVirtualPageCount()

ssize_t Process::getVirtualPageCount ( ) const
inline

Definition at line 905 of file Process.h.

◆ hasSharedAddressSpace()

bool Process::hasSharedAddressSpace ( ) const
inline

Get whether this process has a shared address space with its parent. Copy-on-write (i.e. not shared) is the default for processes.

Definition at line 919 of file Process.h.

◆ inheritFilesystemIds()

void Process::inheritFilesystemIds ( Thread &  child,
const Thread *  creator 
) const

Definition at line 58 of file Process-credentials.cc.

◆ installFilesystemContext()

bool Process::installFilesystemContext ( FilesystemContextOwner &&  context)

Install into an empty slot; failure leaves the staged owner untouched.

Definition at line 734 of file Process.cc.

References m_FilesystemContextLock.

◆ installTerminalOwner()

void Process::installTerminalOwner ( Thread *  owner)
private

Installs the Thread which alone may consume a terminal reservation.

Definition at line 1592 of file Process.cc.

References Vector< T >::begin(), Thread::Continue, Dec, Vector< T >::end(), m_bTerminalOwnerReserved, m_Id, m_Lock, m_pReservedTerminalOwner, and m_Threads.

Referenced by Process::TerminalOwnerReservation::install().

+ Here is the caller graph for this function:

◆ installUserIdentity()

bool Process::installUserIdentity ( User *  user,
Group *  group,
const uint32_t *  groups,
size_t  count 
)
virtual

Definition at line 72 of file Process-credentials.cc.

◆ isSuspended()

bool Process::isSuspended ( )
inline

Definition at line 768 of file Process.h.

◆ isVforkChild()

bool Process::isVforkChild ( ) const
inline

Definition at line 548 of file Process.h.

◆ kill()

void Process::kill ( )

Performs the complete election, quiesce, and teardown sequence.

Definition at line 2019 of file Process.cc.

References beginTermination(), Dec, finishTermination(), ProcessorBase::information(), m_Id, and quiesceTermination().

◆ loadFilesystemIds()

bool Process::loadFilesystemIds ( const Thread &  task,
uint32_t &  uid,
uint32_t &  gid 
)
staticprotected

Definition at line 9 of file Process-credentials.cc.

◆ markTerminating()

void Process::markTerminating ( )

Definition at line 1649 of file Process.cc.

◆ pidIdentity()

SharedPointer< UserspacePid > Process::pidIdentity ( ) const
inline

Definition at line 514 of file Process.h.

◆ pidNamespace()

SharedPointer< UserspacePidNamespace > Process::pidNamespace ( ) const
inline

Definition at line 511 of file Process.h.

◆ pidNamespaceForChildren()

SharedPointer< UserspacePidNamespace > Process::pidNamespaceForChildren ( )

Definition at line 87 of file Process.cc.

◆ pidNamespaceReady()

bool Process::pidNamespaceReady ( ) const

Definition at line 94 of file Process.cc.

◆ prepareForDestruction()

void Process::prepareForDestruction ( )
protected

Removes this process from enumeration and drains inspectors.

Every derived destructor must call this before touching down its own members; the base destructor runs too late to protect derived storage.

Definition at line 1029 of file Process.cc.

References closeDeferredTimeAccounting(), closeExternalLeaseAdmission(), drainExternalLeases(), getParent(), Scheduler::instance(), m_bPublished, m_bUnregistered, m_ChildStateWaiters, m_pInitProcess, and Scheduler::removeProcess().

Referenced by ~Process().

+ Here is the caller graph for this function:

◆ prepareThreadExit()

bool Process::prepareThreadExit ( )

◆ processTerminated()

virtual void Process::processTerminated ( )
inlineprivatevirtual

Called when the process is terminated to allow for subclass cleanup.

Reimplemented in PosixProcess.

Definition at line 1007 of file Process.h.

◆ publish()

void Process::publish ( )
protected

Makes a completely constructed Process visible to enumeration.

Definition at line 944 of file Process.cc.

References Scheduler::addProcess(), getParent(), getUserspaceId(), Scheduler::instance(), m_bPublished, m_ChildStateWaiters, m_pParent, and m_UserspaceNamespace.

Referenced by Process(), Process(), and PosixProcess::publish().

+ Here is the caller graph for this function:

◆ publishAccountIdentity()

void Process::publishAccountIdentity ( User *  user,
Group *  group 
)
protected

Definition at line 67 of file Process-credentials.cc.

◆ publishFilesystemIds()

void Process::publishFilesystemIds ( Thread &  task,
uint32_t  uid,
uint32_t  gid 
)
staticprotected

Definition at line 17 of file Process-credentials.cc.

◆ publishReaperClaim()

void Process::publishReaperClaim ( )
private

Publishes a previously claimed deferred destruction exactly once.

Definition at line 2010 of file Process.cc.

References m_ReaperState.

◆ publishTerminationReapable()

void Process::publishTerminationReapable ( )
private

◆ publishTerminationStatus()

void Process::publishTerminationStatus ( bool  notifyParent)
private

Publishes terminal wait status while the elected owner is still live.

Definition at line 2329 of file Process.cc.

References acquireProcessSignalThread(), Dec, getParent(), Scheduler::instance(), m_ChildStateWaiters, m_Id, m_PendingChildTransition, m_SuspensionWaiters, Subsystem::threadException(), and transitionState().

◆ queueTimeAccountingReport()

void Process::queueTimeAccountingReport ( Time::Timestamp  elapsed)
private

Definition at line 894 of file Process.cc.

◆ quiesceTermination()

bool Process::quiesceTermination ( )

Claims shared teardown for the elected owner and waits until every peer is off-stack. Exactly one call can succeed.

Definition at line 1875 of file Process.cc.

References Spinlock::acquire(), Dec, ProcessorBase::information(), m_bTerminationCleanupStarted, m_bTerminationRendezvousStarted, m_bTerminationSealed, m_Id, m_Lock, m_nTerminationParticipants, m_pTerminatingThread, m_TerminationWaiters, and Spinlock::release().

Referenced by PosixSubsystem::exit(), and kill().

+ Here is the caller graph for this function:

◆ reap()

void Process::reap ( )

Marks the process as reaped.

Callers must hold the parent's child-state wait guard so only one concurrent wait operation can claim the status.

Definition at line 1642 of file Process.cc.

References Dec, m_Id, Reaped, and transitionState().

◆ releaseFilesystemContext()

void Process::releaseFilesystemContext ( )

Definition at line 769 of file Process.cc.

◆ releaseThreadLease()

void Process::releaseThreadLease ( Thread *  thread)
private

Releases both halves of an admitted ThreadLease.

Definition at line 1296 of file Process.cc.

References endExternalLease(), and Thread::endExternalLease().

◆ releaseVforkAddressSpace()

void Process::releaseVforkAddressSpace ( )

Caller holds the mapping operation guard and has retired user-memory hooks.

Definition at line 711 of file Process.cc.

References ProcessorBase::getInterrupts(), Thread::getParent(), ProcessorBase::information(), m_pAddressSpace, ProcessorBase::setInterrupts(), and ProcessorBase::switchAddressSpace().

Referenced by PosixSubsystem::exit(), PosixSubsystem::invoke(), and PosixSubsystem::~PosixSubsystem().

+ Here is the caller graph for this function:

◆ removeThread()

void Process::removeThread ( Thread *  pThread)

Removes a thread from this process.

Definition at line 1351 of file Process.cc.

References Vector< T >::begin(), Vector< T >::end(), Vector< T >::erase(), Thread::getUserTime(), m_bDestroying, m_Lock, m_pSubsystem, m_Threads, m_TimeAccountingLock, Subsystem::threadRemoved(), and Process::ProcessMetadata::userTime.

Referenced by Thread::~Thread().

+ Here is the caller graph for this function:

◆ replaceFilesystemContext()

bool Process::replaceFilesystemContext ( FilesystemContextOwner &&  replacement,
const FilesystemContextRef &  expected 
)

Definition at line 746 of file Process.cc.

◆ reportTimeAccounting()

ALWAYS_INLINE void Process::reportTimeAccounting ( Time::Timestamp  elapsed)
inlineprivate

Definition at line 995 of file Process.h.

◆ reportTimesUpdated()

virtual void Process::reportTimesUpdated ( Time::Timestamp  userTotal,
Time::Timestamp  total 
)
inlineprivatevirtual

Called by the accounting worker with absolute userspace and total time. This is never invoked by trackTime() or while scheduler locks are held.

Reimplemented in PosixProcess.

Definition at line 984 of file Process.h.

Referenced by drainDeferredTimeAccounting().

+ Here is the caller graph for this function:

◆ reserveTerminalOwner()

Process::TerminalOwnerReservation Process::reserveTerminalOwner ( )

Reserves the Active/Suspended lifecycle while a terminal owner is constructed. Competing exit attempts take the thread-only path until the installed owner enters process termination.

Definition at line 1560 of file Process.cc.

References Spinlock::acquire(), Dec, m_bDestroying, m_bTerminalOwnerReserved, m_bTerminationRendezvousStarted, m_bTerminationSealed, m_Id, m_Lock, m_pReservedTerminalOwner, Reaped, and Spinlock::release().

◆ resetCounts()

void Process::resetCounts ( )
inline

Definition at line 821 of file Process.h.

◆ resetUserReservations()

void Process::resetUserReservations ( )

Definition at line 197 of file Process-reservations.cc.

◆ resume()

void Process::resume ( )

◆ rootPidNamespace()

SharedPointer< UserspacePidNamespace > Process::rootPidNamespace ( )
static

Definition at line 83 of file Process.cc.

◆ selectPendingChildTransition()

bool Process::selectPendingChildTransition ( bool  includeStopped,
bool  includeContinued,
bool  consume,
ChildTransition &  transition 
)

Selects a pending child transition, optionally consuming it. Unrequested transitions remain pending; a miss clears the output. The caller holds the parent's child-state guard.

Definition at line 2215 of file Process.cc.

References m_PendingChildTransition, and m_SuspensionWaiters.

Referenced by takePendingChildTransition().

+ Here is the caller graph for this function:

◆ setCtty()

bool Process::setCtty ( File *  file)

Null is infallible; a positive install can fail to retain or allocate.

Definition at line 820 of file Process.cc.

References File::releaseVfsReference(), File::retainVfsReference(), and SharedPointer< T >::tryAdopt().

◆ setCttyContext()

void Process::setCttyContext ( const SharedPointer< ControllingTerminal > &  context)

Definition at line 810 of file Process.cc.

◆ setEffectiveGroup()

void Process::setEffectiveGroup ( Group *  pGroup)

Definition at line 145 of file Process-credentials.cc.

◆ setEffectiveGroupId()

void Process::setEffectiveGroupId ( int64_t  id)
virtual

Definition at line 2268 of file Process.cc.

◆ setEffectiveUser()

void Process::setEffectiveUser ( User *  pUser)

Sets the effective user.

Definition at line 133 of file Process-credentials.cc.

References m_NativeFilesystemCredentials, and m_pEffectiveUser.

◆ setEffectiveUserId()

void Process::setEffectiveUserId ( int64_t  id)
virtual

Definition at line 2266 of file Process.cc.

◆ setExitStatus()

void Process::setExitStatus ( int  code)
inline

Sets the exit status of the process.

Definition at line 556 of file Process.h.

Referenced by PosixSubsystem::exit().

+ Here is the caller graph for this function:

◆ setGroup()

void Process::setGroup ( Group *  pGroup)

Sets the current group.

Definition at line 139 of file Process-credentials.cc.

References m_NativeFilesystemCredentials, and m_pGroup.

◆ setGroupId()

void Process::setGroupId ( int64_t  id)
virtual

Definition at line 2264 of file Process.cc.

◆ setInit()

void Process::setInit ( Process *  pProcess)
static

Set the init process.

Definition at line 2421 of file Process.cc.

References m_pInitProcess.

◆ setLinker()

void Process::setLinker ( DynamicLinker *  pDl)
inline

Definition at line 714 of file Process.h.

◆ setSubsystem()

void Process::setSubsystem ( Subsystem *  pSubsystem)
inline

Definition at line 721 of file Process.h.

◆ setTimeAccountingReportInterest()

void Process::setTimeAccountingReportInterest ( size_t  interest,
bool  enabled 
)
protected

Changes independently owned report-interest bits without losing pending work.

Definition at line 844 of file Process.cc.

References ProcessorBase::information(), m_bTimeAccountingReportsEnabled, m_DeferredTimeAccounting, and DeferredTimeAccounting::publish().

◆ setUser()

void Process::setUser ( User *  pUser)

Sets the current user.

Definition at line 127 of file Process-credentials.cc.

References m_NativeFilesystemCredentials.

◆ setUserId()

void Process::setUserId ( int64_t  id)
virtual

Definition at line 2262 of file Process.cc.

◆ snapshotFilesystemCredentials()

bool Process::snapshotFilesystemCredentials ( const Thread *  task,
FilesystemCredentials &  out 
) const
virtual

Definition at line 23 of file Process-credentials.cc.

◆ snapshotUserReservations()

bool Process::snapshotUserReservations ( UserReservationSnapshot &  result)

Definition at line 16 of file Process-reservations.cc.

◆ suspend()

void Process::suspend ( int  stopSignal = 0)

Suspends the process.

Definition at line 2051 of file Process.cc.

References suspendInternal().

◆ suspendIfContinuationEpoch()

void Process::suspendIfContinuationEpoch ( int  stopSignal,
size_t  continuationEpoch 
)

Suspends only if no continuation has occurred since the stop was queued.

Definition at line 2055 of file Process.cc.

References suspendInternal().

◆ suspendInternal()

void Process::suspendInternal ( int  stopSignal,
bool  checkContinuationEpoch,
size_t  continuationEpoch 
)
private

◆ takePendingChildTransition()

bool Process::takePendingChildTransition ( bool  includeStopped,
bool  includeContinued,
ChildTransition &  transition 
)

Consuming compatibility entry point for existing child waiters.

Definition at line 2233 of file Process.cc.

References selectPendingChildTransition().

◆ terminatingThreadReapable()

bool Process::terminatingThreadReapable ( Thread *  pThread,
bool &  wakeOwner 
)
private

Accounts for one process-exit participant after it is off-stack. The caller holds m_Lock. Returns true for the last participant and sets wakeOwner when an elected owner may be waiting for peer progress.

Definition at line 2308 of file Process.cc.

References Dec, Thread::getId(), Thread::m_bProcessExitParticipant, m_bTerminationRendezvousStarted, m_bTerminationSealed, m_Id, and m_nTerminationParticipants.

◆ threadExiting()

void Process::threadExiting ( Thread *  pThread)

Runs subsystem cleanup while the exiting thread and address space live.

Definition at line 1336 of file Process.cc.

References m_pSubsystem, and Subsystem::threadExiting().

Referenced by Thread::notifySubsystemExit().

+ Here is the caller graph for this function:

◆ totalTime()

Time::Timestamp Process::totalTime ( CpuTimeMode  mode) const
private

Aggregates live threads and retired totals without taking the topology lock.

Definition at line 900 of file Process.cc.

References Thread::getUserTime(), m_bDestroying, m_Threads, m_TimeAccountingLock, and Process::ProcessMetadata::userTime.

◆ trackHeap()

void Process::trackHeap ( ssize_t  nBytes)
inline

Definition at line 811 of file Process.h.

◆ trackPages()

void Process::trackPages ( ssize_t  nVirtual,
ssize_t  nPhysical,
ssize_t  nShared 
)
inline

Definition at line 815 of file Process.h.

◆ transferExecProcessSignals()

void Process::transferExecProcessSignals ( Thread *  pThread)

Preserves process-owned signals before an exiting thread drains its queue.

Definition at line 1342 of file Process.cc.

References m_pSubsystem, and Subsystem::preserveProcessSignalsForThreadExit().

Referenced by Thread::shutdown().

+ Here is the caller graph for this function:

◆ transitionState()

bool Process::transitionState ( ProcessState  expected,
ProcessState  desired 
)
private

Changes process state only if it still matches the expected state. Active and Suspended may alternate, but no caller may overwrite a terminal lifecycle transition.

Definition at line 1621 of file Process.cc.

References m_State.

Referenced by publishTerminationStatus(), reap(), resume(), suspendInternal(), and transitionToTerminating().

+ Here is the caller graph for this function:

◆ transitionToTerminating()

void Process::transitionToTerminating ( )
private

Advances Active or Suspended to Terminating without downgrading.

Definition at line 1626 of file Process.cc.

References Dec, m_Id, and transitionState().

Referenced by beginTermination(), and prepareThreadExit().

+ Here is the caller graph for this function:

◆ tryClaimReaper()

Process::ReaperClaim Process::tryClaimReaper ( )

Claims the sole deferred-destruction publication for this Process.

Definition at line 2001 of file Process.cc.

References m_ReaperState.

◆ unsharePidNamespace() [1/2]

bool Process::unsharePidNamespace ( )

Definition at line 122 of file Process.cc.

◆ unsharePidNamespace() [2/2]

bool Process::unsharePidNamespace ( const SharedPointer< UserspacePidNamespace > &  prepared)

Definition at line 130 of file Process.cc.

◆ waitUntilTerminationReapable()

bool Process::waitUntilTerminationReapable ( )

Blocks a deferred reaper until the terminating thread is off-stack. Returns false rather than self-deadlocking if called by that thread.

Definition at line 2270 of file Process.cc.

References ProcessorBase::information(), m_bTerminationReapable, m_pTerminatingThread, m_TerminationWaiters, and WaitQueue::Guard::waitForCompletion().

Referenced by beginTermination().

+ Here is the caller graph for this function:

◆ waitUntilTerminationReapableForTerminalCoordinator()

bool Process::waitUntilTerminationReapableForTerminalCoordinator ( )

Polls terminal completion without sleeping the shutdown coordinator. This keeps it runnable as the last same-CPU exit owner's successor.

Definition at line 2292 of file Process.cc.

References ProcessorBase::information(), Scheduler::instance(), m_bTerminationReapable, m_pTerminatingThread, m_TerminationWaiters, and Scheduler::yield().

Friends And Related Symbol Documentation

◆ PerProcessorScheduler

friend class PerProcessorScheduler
friend

Definition at line 110 of file Process.h.

◆ Scheduler

friend class Scheduler
friend

Definition at line 111 of file Process.h.

◆ Thread

friend class Thread
friend

Definition at line 112 of file Process.h.

◆ ZombieProcess

friend class ZombieProcess
friend

Definition at line 113 of file Process.h.

◆ ZombieQueue

friend class ZombieQueue
friend

Definition at line 114 of file Process.h.

Member Data Documentation

◆ m_bDestroying

bool Process::m_bDestroying
private

Process destruction is iterating m_Threads and owns its cleanup.

Definition at line 1155 of file Process.h.

Referenced by addThread(), removeThread(), reserveTerminalOwner(), totalTime(), and ~Process().

◆ m_bExecCommitted

bool Process::m_bExecCommitted = false
private

Definition at line 1168 of file Process.h.

◆ m_bExecExitForwarded

bool Process::m_bExecExitForwarded = false
private

Definition at line 1169 of file Process.h.

◆ m_bExternalLeaseAdmissionClosed

bool Process::m_bExternalLeaseAdmissionClosed
private

Whether scheduler removal has closed Process lease admission.

Definition at line 1127 of file Process.h.

Referenced by beginExternalLease(), closeExternalLeaseAdmission(), drainExternalLeases(), and endExternalLease().

◆ m_bExternalLeaseReleaseInProgress

bool Process::m_bExternalLeaseReleaseInProgress
private

Whether a closed final release is completing its waiter handoff.

Definition at line 1130 of file Process.h.

Referenced by drainExternalLeases(), and endExternalLease().

◆ m_bFilesystemContextReady

bool Process::m_bFilesystemContextReady
private

Definition at line 1046 of file Process.h.

◆ m_bPublished

bool Process::m_bPublished
private

Whether this object has been published to scheduler enumeration.

Definition at line 1158 of file Process.h.

Referenced by prepareForDestruction(), and publish().

◆ m_bSharedAddressSpace

bool Process::m_bSharedAddressSpace
private

Is our address space shared with the parent?

Definition at line 1331 of file Process.h.

◆ m_bTerminalOwnerReserved

bool Process::m_bTerminalOwnerReserved
private

A dedicated exit owner is being constructed or waiting to run.

Definition at line 1180 of file Process.h.

Referenced by beginTermination(), installTerminalOwner(), prepareThreadExit(), and reserveTerminalOwner().

◆ m_bTerminationCleanupStarted

bool Process::m_bTerminationCleanupStarted
private

The elected owner has exclusively claimed shared process teardown.

Definition at line 1186 of file Process.h.

Referenced by quiesceTermination().

◆ m_bTerminationReapable

bool Process::m_bTerminationReapable
private

Whether the scheduler has completed the terminating thread switch.

Definition at line 1192 of file Process.h.

Referenced by beginTermination(), publishTerminationReapable(), waitUntilTerminationReapable(), and waitUntilTerminationReapableForTerminalCoordinator().

◆ m_bTerminationRendezvousStarted

bool Process::m_bTerminationRendezvousStarted
private

Process::kill has installed the complete live-thread rendezvous.

Definition at line 1177 of file Process.h.

Referenced by beginTermination(), prepareThreadExit(), quiesceTermination(), reserveTerminalOwner(), and terminatingThreadReapable().

◆ m_bTerminationSealed

bool Process::m_bTerminationSealed
private

No further thread may join the rendezvous before publication.

Definition at line 1189 of file Process.h.

Referenced by addThread(), beginTermination(), quiesceTermination(), reserveTerminalOwner(), and terminatingThreadReapable().

◆ m_bThreadJoinAdmissionClosed

bool Process::m_bThreadJoinAdmissionClosed
private

Whether Process destruction has closed Thread::join admission.

Definition at line 1112 of file Process.h.

Referenced by beginThreadJoin(), and ~Process().

◆ m_bTimeAccountingReportsEnabled

bool Process::m_bTimeAccountingReportsEnabled
private

Stock kernel processes do not need timer-report worker publications.

Definition at line 1326 of file Process.h.

Referenced by closeDeferredTimeAccounting(), enableTimeAccountingReports(), and setTimeAccountingReportInterest().

◆ m_bUnregistered

bool Process::m_bUnregistered
private

Scheduler enumeration no longer contains this process.

Definition at line 1161 of file Process.h.

Referenced by prepareForDestruction().

◆ m_ChildrenPidNamespace

SharedPointer<UserspacePidNamespace> Process::m_ChildrenPidNamespace
private

Definition at line 1025 of file Process.h.

◆ m_ChildStateWaiters

WaitQueue Process::m_ChildStateWaiters
private

Waiters for state changes in any direct child of this process.

Definition at line 1094 of file Process.h.

Referenced by beginTermination(), prepareForDestruction(), publish(), publishTerminationStatus(), resume(), and suspendInternal().

◆ m_ContinuationEpoch

size_t Process::m_ContinuationEpoch
private

Invalidates default-stop deliveries which predate a continuation.

Definition at line 1103 of file Process.h.

Referenced by getContinuationEpoch(), resume(), and suspendInternal().

◆ m_CredentialLock

Spinlock Process::m_CredentialLock
mutableprotected

Definition at line 933 of file Process.h.

◆ m_Ctty

SharedPointer<ControllingTerminal> Process::m_Ctty
private

Current controlling terminal.

Definition at line 1050 of file Process.h.

◆ m_DeferredThreadReaps

OperationBarrier Process::m_DeferredThreadReaps
private

Pins the Process while an off-stack Thread awaits ordinary destruction.

Definition at line 1323 of file Process.h.

Referenced by ~Process().

◆ m_DeferredTimeAccounting

DeferredTimeAccounting Process::m_DeferredTimeAccounting
private

Lock-free IRQ/scheduler publication consumed by an ordinary worker.

Definition at line 1317 of file Process.h.

Referenced by closeDeferredTimeAccounting(), drainDeferredTimeAccounting(), and setTimeAccountingReportInterest().

◆ m_DynamicSpaceAllocator

MemoryAllocator Process::m_DynamicSpaceAllocator
private

Memory allocator for dynamic address space, if any.

Definition at line 1058 of file Process.h.

Referenced by commitUserReservations().

◆ m_ExecWaiters

WaitQueue Process::m_ExecWaiters
private

Definition at line 1171 of file Process.h.

◆ m_ExitStatus

int Process::m_ExitStatus
private

Terminal process exit status.

Definition at line 1042 of file Process.h.

◆ m_ExternalLeaseLock

Spinlock Process::m_ExternalLeaseLock
private

Short predicate lock. Scheduler enumeration may nest this under the global scheduler lock; it is never held while waking lease drainers.

Definition at line 1118 of file Process.h.

Referenced by beginExternalLease(), closeExternalLeaseAdmission(), drainExternalLeases(), and endExternalLease().

◆ m_ExternalLeaseWaiters

WaitQueue Process::m_ExternalLeaseWaiters
private

Lifetime barrier for scheduler enumeration leases.

Definition at line 1121 of file Process.h.

Referenced by drainExternalLeases(), and endExternalLease().

◆ m_FilesystemContext

FilesystemContextOwner Process::m_FilesystemContext
private

Definition at line 1045 of file Process.h.

◆ m_FilesystemContextLock

Mutex Process::m_FilesystemContextLock
mutableprivate

Protects only the owner slots; provider calls run after unlocking.

Definition at line 1044 of file Process.h.

Referenced by installFilesystemContext().

◆ m_Id

size_t Process::m_Id
private

◆ m_Lock

Spinlock Process::m_Lock
private

◆ m_NativeFilesystemCredentials

FilesystemCredentials Process::m_NativeFilesystemCredentials
private

Current user.

Definition at line 1078 of file Process.h.

Referenced by setEffectiveUser(), setGroup(), and setUser().

◆ m_nExternalLeases

size_t Process::m_nExternalLeases
private

Process leases admitted before scheduler removal.

Definition at line 1124 of file Process.h.

Referenced by beginExternalLease(), drainExternalLeases(), and endExternalLease().

◆ m_NextTid

Atomic<size_t> Process::m_NextTid
private

The next available thread ID.

Definition at line 1016 of file Process.h.

Referenced by addThread().

◆ m_nTerminationParticipants

size_t Process::m_nTerminationParticipants
private

Process-exit participants that have not yet switched off-stack.

Definition at line 1174 of file Process.h.

Referenced by addThread(), beginTermination(), publishTerminationReapable(), quiesceTermination(), and terminatingThreadReapable().

◆ m_nThreadCreations

size_t Process::m_nThreadCreations = 0
private

Definition at line 1170 of file Process.h.

◆ m_nThreadJoinOperations

size_t Process::m_nThreadJoinOperations
private

Join operations admitted before destruction closed the process.

Definition at line 1109 of file Process.h.

Referenced by beginThreadJoin(), endThreadJoin(), and ~Process().

◆ m_pAddressSpace

VirtualAddressSpace* Process::m_pAddressSpace
private

Our virtual address space.

Definition at line 1037 of file Process.h.

Referenced by releaseVforkAddressSpace(), and ~Process().

◆ m_pDynamicLinker

DynamicLinker* Process::m_pDynamicLinker
private

The Process' dynamic linker.

Definition at line 1088 of file Process.h.

◆ m_pEffectiveGroup

Group* Process::m_pEffectiveGroup
private

Effective group.

Definition at line 1085 of file Process.h.

Referenced by getEffectiveGroup().

◆ m_pEffectiveUser

User* Process::m_pEffectiveUser
private

Effective user.

Definition at line 1083 of file Process.h.

Referenced by getEffectiveUser(), and setEffectiveUser().

◆ m_PendingChildTransition

ChildTransition Process::m_PendingChildTransition
private

Latest stop/continue transition not yet selected by a parent wait.

Definition at line 1133 of file Process.h.

Referenced by publishTerminationStatus(), resume(), selectPendingChildTransition(), and suspendInternal().

◆ m_pExecOwner

Thread* Process::m_pExecOwner = nullptr
private

Replacement admission and its irreversible sibling teardown phase.

Definition at line 1167 of file Process.h.

Referenced by acquireProcessSignalThread(), and beginTermination().

◆ m_pGroup

Group* Process::m_pGroup
private

Current group.

Definition at line 1081 of file Process.h.

Referenced by getGroup(), and setGroup().

◆ m_pInitProcess

Process * Process::m_pInitProcess = 0
staticprivate

Init process (terminated processes' children will reparent to this).

Definition at line 1334 of file Process.h.

Referenced by beginTermination(), getInit(), prepareForDestruction(), and setInit().

◆ m_pParent

Process* Process::m_pParent
private

Our parent process.

Definition at line 1033 of file Process.h.

Referenced by beginTermination(), and publish().

◆ m_pReservedTerminalOwner

Thread* Process::m_pReservedTerminalOwner
private

Installed owner permitted to consume the terminal reservation.

Definition at line 1183 of file Process.h.

Referenced by beginTermination(), installTerminalOwner(), prepareThreadExit(), and reserveTerminalOwner().

◆ m_pSubsystem

Subsystem* Process::m_pSubsystem
private

The subsystem for this process

Definition at line 1091 of file Process.h.

Referenced by removeThread(), threadExiting(), transferExecProcessSignals(), and ~Process().

◆ m_pTerminatingThread

Thread* Process::m_pTerminatingThread
private

Thread that initiated exit, used to reject self-waiting destruction.

Definition at line 1164 of file Process.h.

Referenced by beginTermination(), publishTerminationReapable(), quiesceTermination(), waitUntilTerminationReapable(), and waitUntilTerminationReapableForTerminalCoordinator().

◆ m_pUser

User* Process::m_pUser
private

Definition at line 1079 of file Process.h.

◆ m_pVforkOwner

Process* Process::m_pVforkOwner = nullptr
private

Definition at line 1039 of file Process.h.

◆ m_pVforkPrivateAddressSpace

VirtualAddressSpace* Process::m_pVforkPrivateAddressSpace = nullptr
private

Definition at line 1038 of file Process.h.

◆ m_ReaperState

size_t Process::m_ReaperState
private

One-shot ownership of deferred Process destruction.

Definition at line 1201 of file Process.h.

Referenced by publishReaperClaim(), and tryClaimReaper().

◆ m_SpaceAllocator

MemoryAllocator Process::m_SpaceAllocator
private

Memory allocator for primary address space.

Definition at line 1054 of file Process.h.

Referenced by commitUserReservations().

◆ m_State

ProcessState Process::m_State
private

Our current state.

Definition at line 1136 of file Process.h.

Referenced by transitionState().

◆ m_SuspensionWaiters

WaitQueue Process::m_SuspensionWaiters
private

Predicate queue for the process stopped/running state.

Definition at line 1100 of file Process.h.

Referenced by getContinuationEpoch(), publishTerminationStatus(), resume(), selectPendingChildTransition(), and suspendInternal().

◆ m_TerminationWaiters

WaitQueue Process::m_TerminationWaiters
private

◆ m_ThreadJoinWaiters

WaitQueue Process::m_ThreadJoinWaiters
private

Lifetime barrier for Thread::join operations using this process.

Definition at line 1106 of file Process.h.

Referenced by beginThreadJoin(), endThreadJoin(), and ~Process().

◆ m_Threads

Vector<Thread*> Process::m_Threads
private

◆ m_TimeAccountingLock

Spinlock Process::m_TimeAccountingLock
mutableprivate

Totals may be queried under timer, signal, or child-state locks. Writers take this inside m_Lock only around vector mutation and retired transfer; readers take only this lock and never invoke callbacks while holding it.

Definition at line 1211 of file Process.h.

Referenced by addThread(), removeThread(), totalTime(), and ~Process().

◆ m_TimeAccountingReportInterest

size_t Process::m_TimeAccountingReportInterest
private

Definition at line 1328 of file Process.h.

◆ m_TimeAccountingReports

OperationBarrier Process::m_TimeAccountingReports
private

Prevents time-report callbacks from crossing process teardown.

Definition at line 1320 of file Process.h.

Referenced by closeDeferredTimeAccounting(), and drainDeferredTimeAccounting().

◆ m_Type

const ProcessType Process::m_Type
private

Definition at line 1139 of file Process.h.

◆ m_UserReservationGeneration

uint64_t Process::m_UserReservationGeneration
private

Definition at line 1060 of file Process.h.

◆ m_UserReservationLock

Spinlock Process::m_UserReservationLock
private

Definition at line 1059 of file Process.h.

◆ m_UserspaceNamespace

SharedPointer<UserspacePidNamespace> Process::m_UserspaceNamespace
private

Shared userspace PID namespace inherited by child processes.

Definition at line 1022 of file Process.h.

Referenced by addThread(), beginTermination(), and publish().

◆ m_UserspacePid

SharedPointer<UserspacePid> Process::m_UserspacePid
private

PID assigned within m_UserspaceNamespace; zero for kernel-only processes.

Definition at line 1024 of file Process.h.

Referenced by addThread().

◆ m_VforkCompletion

SharedPointer<VforkCompletion> Process::m_VforkCompletion
private

Definition at line 1040 of file Process.h.

◆ str

LargeStaticString Process::str
private

Our description string.

Definition at line 1029 of file Process.h.

Referenced by ~Process().


The documentation for this class was generated from the following files: