lockvalidator.h revision cb5363b6fa48f10b080cb6195f56c0823f7c0b0f
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * IPRT - Lock Validator.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright (C) 2009 Sun Microsystems, Inc.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * available from http://www.virtualbox.org. This file is free software;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * General Public License (GPL) as published by the Free Software
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * The contents of this file may alternatively be used under the terms
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * of the Common Development and Distribution License Version 1.0
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * VirtualBox OSE distribution, in which case the provisions of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL are applicable instead of those of the GPL.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You may elect to license modified versions of this file under the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * terms and conditions of either the GPL or the CDDL or both.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * additional information or have any questions.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/** @defgroup grp_ldr RTLockValidator - Lock Validator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @ingroup grp_rt
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** The file where the lock was taken. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** The function where the lock was taken. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** Some ID indicating where the lock was taken, typically an address. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** The line number in the file. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncAssertCompileSize(RTLOCKVALIDATORSRCPOS, HC_ARCH_BITS == 32 ? 16 : 32);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/* The pointer types are defined in iprt/types.h. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/** @def RTLOCKVALIDATORSRCPOS_INIT
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Initializer for a RTLOCKVALIDATORSRCPOS variable.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param pszFile The file name. Optional (NULL).
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param uLine The line number in that file. Optional (0).
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param pszFunction The function. Optional (NULL).
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param uId Some location ID, normally the return address.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Optional (NULL).
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# define RTLOCKVALIDATORSRCPOS_INIT(pszFile, uLine, pszFunction, uId) \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# define RTLOCKVALIDATORSRCPOS_INIT(pszFile, uLine, pszFunction, uId) \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/** @def RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Initializer for a RTLOCKVALIDATORSRCPOS variable in a typicial debug API
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * variant. Assumes RT_SRC_POS_DECL and RTHCUINTPTR uId as arguments.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync RTLOCKVALIDATORSRCPOS_INIT(pszFile, iLine, pszFunction, uId)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/** @def RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Initializer for a RTLOCKVALIDATORSRCPOS variable in a normal API
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * variant. Assumes iprt/asm.h is included.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync RTLOCKVALIDATORSRCPOS_INIT(__FILE__, __LINE__, __PRETTY_FUNCTION__, (uintptr_t)ASMReturnAddress())
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Record recording the ownership of a lock.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * This is typically part of the per-lock data structure when compiling with
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * the lock validator.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** Magic value (RTLOCKVALIDATORREC_MAGIC). */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** Reserved. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** Source position where the lock was taken. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** The current owner thread. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** Pointer to the lock record below us. Only accessed by the owner. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** Recursion count */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** The lock sub-class. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** The lock class. */
typedef struct RTLOCKVALIDATORSHAREDONE
typedef struct RTLOCKVALIDATORSHARED
bool volatile fReallocating;
RTDECL(int) RTLockValidatorCheckOrder(PRTLOCKVALIDATORREC pRec, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos);
RTDECL(int) RTLockValidatorRecordRecursion(PRTLOCKVALIDATORREC pRec, PCRTLOCKVALIDATORSRCPOS pSrcPos);