kernel tracing: implement fallback for meta data allocation
We the meta data area couldn't be allocated in any of the supported (reattachable) places, just use a static allocation. The tracing feature wouldn't be available at all in such a case.
This commit is contained in:
parent
8a8a325a1e
commit
c53508b730
@ -127,8 +127,8 @@ private:
|
|||||||
uint32 fMagic3;
|
uint32 fMagic3;
|
||||||
};
|
};
|
||||||
|
|
||||||
static TracingMetaData sDummyTracingMetaData;
|
static TracingMetaData sFallbackTracingMetaData;
|
||||||
static TracingMetaData* sTracingMetaData = &sDummyTracingMetaData;
|
static TracingMetaData* sTracingMetaData = &sFallbackTracingMetaData;
|
||||||
static bool sTracingDataRecovered = false;
|
static bool sTracingDataRecovered = false;
|
||||||
|
|
||||||
|
|
||||||
@ -525,7 +525,15 @@ TracingMetaData::_CreateMetaDataArea(bool findPrevious, area_id& _area,
|
|||||||
delete_area(area);
|
delete_area(area);
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_ENTRY_NOT_FOUND;
|
if (findPrevious)
|
||||||
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
|
||||||
|
// We could allocate any of the standard locations. Instead of failing
|
||||||
|
// entirely, we use the static meta data. The tracing buffer won't be
|
||||||
|
// reattachable in the next session, but at least we can use it in this
|
||||||
|
// session.
|
||||||
|
_metaData = &sFallbackTracingMetaData;
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1786,7 +1794,8 @@ tracing_init(void)
|
|||||||
#if ENABLE_TRACING
|
#if ENABLE_TRACING
|
||||||
status_t result = TracingMetaData::Create(sTracingMetaData);
|
status_t result = TracingMetaData::Create(sTracingMetaData);
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
sTracingMetaData = &sDummyTracingMetaData;
|
memset(&sFallbackTracingMetaData, 0, sizeof(sFallbackTracingMetaData));
|
||||||
|
sTracingMetaData = &sFallbackTracingMetaData;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user