Namespaces

Enumerations

enum class LockResult : uint8_t
Name Value Comments
Success 0 --
AlreadyAcquired 1 --
OutOfOrder 2 --
InvalidNesting 3 --
InvalidIrqSafety 4 --
Reentrance 5 --
ShouldNotHold 6 --
AcquireAfterLeaf 7 --
MaxLockDependencies 8

Non-fatal error that indicates the dependency hash set for a particular
lock class is full. Consider increasing the size of the lock dependency
sets if this error is reported.

DependencyExists 9

Internal error value used to differentiate between dependency set updates
that add a new edge and those that do not. Only new edges trigger loop
detection.

Result type that represents whether a lock attempt was successful, or if not

which check failed.

Defined at line 124 of file ../../zircon/system/ulib/lockdep/include/lockdep/common.h

enum LockFlags : uint16_t
Name Value Comments
LockFlagsNone 0

Apply only common rules that apply to all locks.

LockFlagsIrqSafe (1 << 0)

Apply the irq-safety rules in addition to the common rules for all locks.

LockFlagsNestable (1 << 1)

Apply the nestable rules in addition to the common rules for all locks.

LockFlagsMultiAcquire (1 << 2)

Apply the multi-acquire rules in additioon to the common rules for all
locks.

LockFlagsLeaf (1 << 3)

Apply the leaf lock rules in addition to the common rules for all locks.
NOTE: Use this flag with caution. See https://fxbug.dev/459856993.

LockFlagsReportingDisabled (1 << 4)

Do not report validation errors. This flag prevents recursive validation
of locks that are acquired by reporting routines.

LockFlagsSingletonLock (1 << 5)

There is only one member of this locks class.

LockFlagsReAcquireFatal (1 << 6)

Abort the program with an error if a lock is improperly acquired more
than once in the same context.

LockFlagsActiveListDisabled (1 << 7)

Do not add this acquisition to the active list. This may be required for
locks that are used to protect context switching logic.

LockFlagsTrackingDisabled (1 << 8)

Do not track this lock.

Flags to specify which rules to apply to a lock class during validation.

Defined at line 15 of file ../../zircon/system/ulib/lockdep/include/lockdep/lock_traits.h

enum class FeatureLevel : uint8_t
Name Value
Disabled 0
MetadataOnly 1
Validation 2

Enumeration of supported feature levels.

Defined at line 91 of file ../../zircon/system/ulib/lockdep/include/lockdep/common.h

enum OrderedLockTag
Name Value
OrderedLock 0

Type tag to select the (private) ordered Guard constructor.

Defined at line 99 of file ../../zircon/system/ulib/lockdep/include/lockdep/guard.h

enum AssertOrderedLockTag
Name Value
AssertOrderedLock 0

Type tag to select the ordered Guard constructor for type erased locks.

Defined at line 102 of file ../../zircon/system/ulib/lockdep/include/lockdep/guard.h

enum AdoptLockTag
Name Value
AdoptLock 0

Type tag to select the adopting Guard constructor.

Defined at line 105 of file ../../zircon/system/ulib/lockdep/include/lockdep/guard.h

enum AliasedLockTag
Name Value
AliasedLock 0

Type tag to select the aliased lock Guard constructor.

Defined at line 108 of file ../../zircon/system/ulib/lockdep/include/lockdep/guard.h

enum AssertOrderedAliasedLockTag
Name Value
AssertOrderedAliasedLock 0

Type tag to select the aliased lock and ordered Guard constructor for type

erased locks.

Defined at line 112 of file ../../zircon/system/ulib/lockdep/include/lockdep/guard.h

Records

Functions

  • void SystemLockValidationError (AcquiredLockEntry * lock_entry, AcquiredLockEntry * conflicting_entry, ThreadLockState * state, void * caller_address, void * caller_frame, LockResult result)

    System-defined hook to report detected lock validation failures.

    Defined at line 44 of file ../../zircon/system/ulib/lockdep/test/lock_dep_test.cc

  • void SystemLockValidationFatal (AcquiredLockEntry * lock_entry, ThreadLockState * state, void * caller_address, void * caller_frame, LockResult result)

    System-defined hook to abort the program due to a fatal lock violation.

    Defined at line 49 of file ../../zircon/system/ulib/lockdep/test/lock_dep_test.cc

  • void SystemCircularLockDependencyDetected (ValidatorLockClassState * connected_set_root)

    System-defined hook to report detection of a circular lock dependency.

  • ThreadLockState * SystemGetThreadLockState (LockFlags lock_flags)

    Default implementation of the runtime functions supporting the thread-local

    ThreadLockState. These MUST be overridden in environments that do not support

    the C++ thread_local TLS mechanism.

    Defined at line 21 of file ../../zircon/system/ulib/lockdep/lock_dep.cc

  • void SystemInitThreadLockState (ThreadLockState * state)

    System-defined hook that initializes the ThreadLockState for the current thread.

    Defined at line 26 of file ../../zircon/system/ulib/lockdep/lock_dep.cc

  • void SystemCircularLockDependencyDetected (LockClassState * connected_set_root)

    Defined at line 53 of file ../../zircon/system/ulib/lockdep/test/lock_dep_test.cc

  • LockFlags operator| (LockFlags a, LockFlags b)

    Prevent implicit conversion to int of bitwise-or expressions involving

    LockFlags.

    Defined at line 54 of file ../../zircon/system/ulib/lockdep/include/lockdep/lock_traits.h

  • void SystemTriggerLoopDetection ()

    System-defined hook that triggers a loop detection pass. In response to this

    event the implementation must trigger a call lockdep::LoopDetectionPass() on

    a separate, dedicated or non-reentrant worker thread. Non-reentrancy is a

    hard requirement as lockdep::LoopDetectionPass() mutates non-thread safe

    state. An implementation may add hysteresis to prevent too many passes in a

    given time interval.

    Defined at line 57 of file ../../zircon/system/ulib/lockdep/test/lock_dep_test.cc

  • LockFlags operator& (LockFlags a, LockFlags b)

    Prevent implicit conversion to int of bitwise-and expressions involving

    LockFlags.

    Defined at line 61 of file ../../zircon/system/ulib/lockdep/include/lockdep/lock_traits.h

  • template <typename Lockable, typename Option = void>
    void AssertHeld (const Lockable & lock)

    Assert that the given lock is exclusively held by the current thread.

    Can be used both for runtime debugging checks, and also to help when

    thread safety analysis can't prove you are holding a lock. The underlying

    lock implementation may optimize away asserts in release builds.

    Calling this function requires that LockType has a policy implementing

    `AssertHeld`. The default policy automatically implements AssertHeld

    if the underlying lock object has an `AssertHeld` method.

    Defined at line 93 of file ../../zircon/system/ulib/lockdep/include/lockdep/guard.h

  • const char * ToString (LockResult result)

    Returns a string representation of the given LockResult.

    Defined at line 146 of file ../../zircon/system/ulib/lockdep/include/lockdep/common.h

  • void AssertNoLocksHeld ()

    Generates a fatal system report if the current thread holds any tracked locks.

    Defined at line 272 of file ../../zircon/system/ulib/lockdep/include/lockdep/thread_lock_state.h

  • void LoopDetectionPass ()

    Runs a loop detection pass to find circular lock dependencies. This must be

    invoked at some point in the future after the lock validator calls the

    system-defined SystemTriggerLoopDetection().

    Defined at line 421 of file ../../zircon/system/ulib/lockdep/include/lockdep/lock_class_state.h

  • ThreadLockState * SystemGetThreadLockState ()