kernel: Fixed broken port tracing.
* Broken since the scheduler merge.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011, Ingo Weinhold, [email protected].
|
* Copyright 2011, Ingo Weinhold, [email protected].
|
||||||
* Copyright 2002-2010, Axel Dörfler, [email protected].
|
* Copyright 2002-2015, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Copyright 2001, Mark-Jan Bastian. All rights reserved.
|
* Copyright 2001, Mark-Jan Bastian. All rights reserved.
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <port.h>
|
#include <port.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <iovec.h>
|
#include <iovec.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -288,6 +289,17 @@ private:
|
|||||||
|
|
||||||
class Read : public AbstractTraceEntry {
|
class Read : public AbstractTraceEntry {
|
||||||
public:
|
public:
|
||||||
|
Read(const BReference<Port>& portRef, int32 code, ssize_t result)
|
||||||
|
:
|
||||||
|
fID(portRef->id),
|
||||||
|
fReadCount(portRef->read_count),
|
||||||
|
fWriteCount(portRef->write_count),
|
||||||
|
fCode(code),
|
||||||
|
fResult(result)
|
||||||
|
{
|
||||||
|
Initialized();
|
||||||
|
}
|
||||||
|
|
||||||
Read(port_id id, int32 readCount, int32 writeCount, int32 code,
|
Read(port_id id, int32 readCount, int32 writeCount, int32 code,
|
||||||
ssize_t result)
|
ssize_t result)
|
||||||
:
|
:
|
||||||
@@ -348,6 +360,17 @@ private:
|
|||||||
|
|
||||||
class Info : public AbstractTraceEntry {
|
class Info : public AbstractTraceEntry {
|
||||||
public:
|
public:
|
||||||
|
Info(const BReference<Port>& portRef, int32 code, ssize_t result)
|
||||||
|
:
|
||||||
|
fID(portRef->id),
|
||||||
|
fReadCount(portRef->read_count),
|
||||||
|
fWriteCount(portRef->write_count),
|
||||||
|
fCode(code),
|
||||||
|
fResult(result)
|
||||||
|
{
|
||||||
|
Initialized();
|
||||||
|
}
|
||||||
|
|
||||||
Info(port_id id, int32 readCount, int32 writeCount, int32 code,
|
Info(port_id id, int32 readCount, int32 writeCount, int32 code,
|
||||||
ssize_t result)
|
ssize_t result)
|
||||||
:
|
:
|
||||||
@@ -743,7 +766,7 @@ copy_port_message(port_message* message, int32* _code, void* buffer,
|
|||||||
size_t bufferSize, bool userCopy)
|
size_t bufferSize, bool userCopy)
|
||||||
{
|
{
|
||||||
// check output buffer size
|
// check output buffer size
|
||||||
size_t size = min_c(bufferSize, message->size);
|
size_t size = std::min(bufferSize, message->size);
|
||||||
|
|
||||||
// copy message
|
// copy message
|
||||||
if (_code != NULL)
|
if (_code != NULL)
|
||||||
@@ -1339,7 +1362,7 @@ _get_port_message_info_etc(port_id id, port_message_info* info,
|
|||||||
status_t status = entry.Wait(flags, timeout);
|
status_t status = entry.Wait(flags, timeout);
|
||||||
|
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
T(Info(port, 0, status));
|
T(Info(portRef, 0, status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1371,7 +1394,7 @@ _get_port_message_info_etc(port_id id, port_message_info* info,
|
|||||||
info->sender_group = message->sender_group;
|
info->sender_group = message->sender_group;
|
||||||
info->sender_team = message->sender_team;
|
info->sender_team = message->sender_team;
|
||||||
|
|
||||||
T(Info(id, id->read_count, id->write_count, message->code, B_OK));
|
T(Info(portRef, message->code, B_OK));
|
||||||
|
|
||||||
// notify next one, as we haven't read from the port
|
// notify next one, as we haven't read from the port
|
||||||
portRef->read_condition.NotifyOne();
|
portRef->read_condition.NotifyOne();
|
||||||
@@ -1495,8 +1518,7 @@ read_port_etc(port_id id, int32* _code, void* buffer, size_t bufferSize,
|
|||||||
portRef->write_condition.NotifyOne();
|
portRef->write_condition.NotifyOne();
|
||||||
// make one spot in queue available again for write
|
// make one spot in queue available again for write
|
||||||
|
|
||||||
T(Read(id, portRef->read_count, portRef->write_count, message->code,
|
T(Read(portRef, message->code, std::min(bufferSize, message->size)));
|
||||||
min_c(bufferSize, message->size)));
|
|
||||||
|
|
||||||
locker.Unlock();
|
locker.Unlock();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user