Made kernel tracing safe to be used right after it has officially
been initialized. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24613 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9fcee65eaf
commit
989a6e05ec
@ -171,7 +171,7 @@ make_space(size_t needed)
|
|||||||
static trace_entry*
|
static trace_entry*
|
||||||
allocate_entry(size_t size, uint16 flags)
|
allocate_entry(size_t size, uint16 flags)
|
||||||
{
|
{
|
||||||
if (sBuffer == NULL || size == 0 || size >= 65532)
|
if (sAfterLastEntry == NULL || size == 0 || size >= 65532)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
InterruptsSpinLocker _(sLock);
|
InterruptsSpinLocker _(sLock);
|
||||||
@ -290,9 +290,8 @@ TraceEntry::operator new(size_t size, const std::nothrow_t&) throw()
|
|||||||
{
|
{
|
||||||
#if ENABLE_TRACING
|
#if ENABLE_TRACING
|
||||||
return allocate_entry(size, 0);
|
return allocate_entry(size, 0);
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif
|
#endif
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -300,11 +299,14 @@ TraceEntry::operator new(size_t size, const std::nothrow_t&) throw()
|
|||||||
|
|
||||||
|
|
||||||
AbstractTraceEntry::AbstractTraceEntry()
|
AbstractTraceEntry::AbstractTraceEntry()
|
||||||
:
|
|
||||||
fThread(thread_get_current_thread_id()),
|
|
||||||
fTeam(team_get_current_team_id()),
|
|
||||||
fTime(system_time())
|
|
||||||
{
|
{
|
||||||
|
struct thread* thread = thread_get_current_thread();
|
||||||
|
if (thread != NULL) {
|
||||||
|
fThread = thread->id;
|
||||||
|
if (thread->team)
|
||||||
|
fTeam = thread->team->id;
|
||||||
|
}
|
||||||
|
fTime = system_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractTraceEntry::~AbstractTraceEntry()
|
AbstractTraceEntry::~AbstractTraceEntry()
|
||||||
|
Loading…
Reference in New Issue
Block a user