diff options
| author | christos <christos@NetBSD.org> | 2018-04-11 18:33:48 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2018-04-11 18:33:48 +0000 |
| commit | 6a18dfde9c6cf84db574a282f3cf5e5759211fa4 (patch) | |
| tree | 1cadc132194d21fe91aa13cc885e358fc162b0e8 /external/apache2 | |
| parent | 895ea98e5333a14be79d254ffb961b22355e0ebc (diff) | |
Add the location of the last lock to help debugging.
Diffstat (limited to 'external/apache2')
3 files changed, 17 insertions, 12 deletions
diff --git a/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c b/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c index be8e1065f0e..97349d24903 100644 --- a/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c +++ b/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c @@ -3838,7 +3838,7 @@ mDNSexport mStatus mDNSSendDNSMessage(mDNS *const m, DNSMessage *const msg, mDNS #pragma mark - RR List Management & Task Management #endif -mDNSexport void mDNS_Lock_(mDNS *const m, const char * const functionname) +mDNSexport void mDNS_Lock_(mDNS *const m, const char * const functionname, int lineno) { // MUST grab the platform lock FIRST! mDNSPlatformLock(m); @@ -3848,20 +3848,20 @@ mDNSexport void mDNS_Lock_(mDNS *const m, const char * const functionname) // If that client callback does mDNS API calls, mDNS_reentrancy and mDNS_busy will both be one // If mDNS_busy != mDNS_reentrancy that's a bad sign if (m->mDNS_busy != m->mDNS_reentrancy) - LogFatalError("%s: mDNS_Lock: Locking failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld)", functionname, m->mDNS_busy, m->mDNS_reentrancy); + LogFatalError("%s,%d: mDNS_Lock: Locking failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld) (last %s,%d)", functionname, lineno, m->mDNS_busy, m->mDNS_reentrancy, m->mDNS_Lock_functionname, m->mDNS_Lock_lineno); // If this is an initial entry into the mDNSCore code, set m->timenow // else, if this is a re-entrant entry into the mDNSCore code, m->timenow should already be set if (m->mDNS_busy == 0) { if (m->timenow) - LogMsg("%s: mDNS_Lock: m->timenow already set (%ld/%ld)", functionname, m->timenow, mDNS_TimeNow_NoLock(m)); + LogMsg("%s,%d: mDNS_Lock: m->timenow already set (%ld/%ld)", functionname, lineno, m->timenow, mDNS_TimeNow_NoLock(m)); m->timenow = mDNS_TimeNow_NoLock(m); if (m->timenow == 0) m->timenow = 1; } else if (m->timenow == 0) { - LogMsg("%s: mDNS_Lock: m->mDNS_busy is %ld but m->timenow not set", functionname, m->mDNS_busy); + LogMsg("%s,%d: mDNS_Lock: m->mDNS_busy is %ld but m->timenow not set", functionname, lineno, m->mDNS_busy); m->timenow = mDNS_TimeNow_NoLock(m); if (m->timenow == 0) m->timenow = 1; } @@ -3869,13 +3869,15 @@ mDNSexport void mDNS_Lock_(mDNS *const m, const char * const functionname) if (m->timenow_last - m->timenow > 0) { m->timenow_adjust += m->timenow_last - m->timenow; - LogMsg("%s: mDNSPlatformRawTime went backwards by %ld ticks; setting correction factor to %ld", functionname, m->timenow_last - m->timenow, m->timenow_adjust); + LogMsg("%s,%d: mDNSPlatformRawTime went backwards by %ld ticks; setting correction factor to %ld", functionname, lineno, m->timenow_last - m->timenow, m->timenow_adjust); m->timenow = m->timenow_last; } m->timenow_last = m->timenow; // Increment mDNS_busy so we'll recognise re-entrant calls m->mDNS_busy++; + m->mDNS_Lock_functionname = functionname; + m->mDNS_Lock_lineno = lineno; } mDNSlocal AuthRecord *AnyLocalRecordReady(const mDNS *const m) @@ -4011,20 +4013,21 @@ mDNSexport void ShowTaskSchedulingError(mDNS *const m) mDNS_Unlock(m); } -mDNSexport void mDNS_Unlock_(mDNS *const m, const char *const functionname) +mDNSexport void mDNS_Unlock_(mDNS *const m, const char *const functionname, int lineno) { // Decrement mDNS_busy m->mDNS_busy--; // Check for locking failures if (m->mDNS_busy != m->mDNS_reentrancy) - LogFatalError("%s: mDNS_Unlock: Locking failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld)", functionname, m->mDNS_busy, m->mDNS_reentrancy); + LogFatalError("%s,%d: mDNS_Unlock: Locking failure! mDNS_busy (%ld) != mDNS_reentrancy (%ld) (last %s,%d)", functionname, lineno, m->mDNS_busy, + m->mDNS_reentrancy, m->mDNS_Lock_functionname, m->mDNS_Lock_lineno); // If this is a final exit from the mDNSCore code, set m->NextScheduledEvent and clear m->timenow if (m->mDNS_busy == 0) { m->NextScheduledEvent = GetNextScheduledEvent(m); - if (m->timenow == 0) LogMsg("%s: mDNS_Unlock: ERROR! m->timenow aready zero", functionname); + if (m->timenow == 0) LogMsg("%s,%d: mDNS_Unlock: ERROR! m->timenow aready zero", functionname, lineno); m->timenow = 0; } diff --git a/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.h b/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.h index e1ef261e7b1..7f0d825866e 100644 --- a/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.h +++ b/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.h @@ -288,16 +288,16 @@ extern mStatus mDNSSendDNSMessage(mDNS *const m, DNSMessage *const msg, mDNSu8 * #endif extern void ShowTaskSchedulingError(mDNS *const m); -extern void mDNS_Lock_(mDNS *const m, const char * const functionname); -extern void mDNS_Unlock_(mDNS *const m, const char * const functionname); +extern void mDNS_Lock_(mDNS *const m, const char * const functionname, int lineno); +extern void mDNS_Unlock_(mDNS *const m, const char * const functionname, int lineno); #if defined(_WIN32) #define __func__ __FUNCTION__ #endif -#define mDNS_Lock(X) mDNS_Lock_((X), __func__) +#define mDNS_Lock(X) mDNS_Lock_((X), __func__, __LINE__) -#define mDNS_Unlock(X) mDNS_Unlock_((X), __func__) +#define mDNS_Unlock(X) mDNS_Unlock_((X), __func__, __LINE__) #define mDNS_CheckLock(X) \ if ((X)->mDNS_busy != (X)->mDNS_reentrancy+1) LogMsg("%s: Lock not held! mDNS_busy (%ld) mDNS_reentrancy (%ld)", __func__, (X)->mDNS_busy, (X)->mDNS_reentrancy) diff --git a/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h b/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h index d840c490b3b..17dadfb2845 100755 --- a/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h +++ b/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h @@ -2319,6 +2319,8 @@ struct mDNS_struct // For debugging: To catch and report locking failures mDNSu32 mDNS_busy; // Incremented between mDNS_Lock/mDNS_Unlock section mDNSu32 mDNS_reentrancy; // Incremented when calling a client callback + const char *mDNS_Lock_functionname; // Where was the last lock taken + int mDNS_Lock_lineno; // and line number: mDNSu8 lock_rrcache; // For debugging: Set at times when these lists may not be modified mDNSu8 lock_Questions; mDNSu8 lock_Records; |
