udp: fix trace build on x86_64.

add current thread id.

Change-Id: I275dcee5ae27e357c8733a1aab9310e9dbc7a839
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2546
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Jérôme Duval 2020-05-01 21:28:32 +02:00 committed by waddlesplash
parent e6aa214527
commit bf9a85cb01

View File

@ -44,12 +44,15 @@
# define TRACE_BLOCK(x) dump_block x
// do not remove the space before ', ##args' if you want this
// to compile with gcc 2.95
# define TRACE_EP(format, args...) dprintf("UDP [%llu] %p " format "\n", \
system_time(), this , ##args)
# define TRACE_EPM(format, args...) dprintf("UDP [%llu] " format "\n", \
system_time() , ##args)
# define TRACE_DOMAIN(format, args...) dprintf("UDP [%llu] (%d) " format \
"\n", system_time(), Domain()->family , ##args)
# define TRACE_EP(format, args...) dprintf("UDP [%" B_PRIu64 ",%" \
B_PRIu32 "] %p " format "\n", system_time(), \
thread_get_current_thread_id(), this , ##args)
# define TRACE_EPM(format, args...) dprintf("UDP [%" B_PRIu64 ",%" \
B_PRIu32 "] " format "\n", system_time() , \
thread_get_current_thread_id() , ##args)
# define TRACE_DOMAIN(format, args...) dprintf("UDP [%" B_PRIu64 ",%" \
B_PRIu32 "] (%d) " format "\n", system_time(), \
thread_get_current_thread_id(), Domain()->family , ##args)
#else
# define TRACE_BLOCK(x)
# define TRACE_EP(args...) do { } while (0)
@ -771,7 +774,7 @@ UdpEndpointManager::ReceiveError(status_t error, net_buffer* buffer)
status_t
UdpEndpointManager::Deframe(net_buffer* buffer)
{
TRACE_EPM("Deframe(%p [%ld bytes])", buffer, buffer->size);
TRACE_EPM("Deframe(%p [%" B_PRIu32 " bytes])", buffer, buffer->size);
NetBufferHeaderReader<udp_header> bufferHeader(buffer);
if (bufferHeader.Status() != B_OK)
@ -995,7 +998,8 @@ UdpEndpoint::Free()
status_t
UdpEndpoint::SendRoutedData(net_buffer *buffer, net_route *route)
{
TRACE_EP("SendRoutedData(%p [%lu bytes], %p)", buffer, buffer->size, route);
TRACE_EP("SendRoutedData(%p [%" B_PRIu32 " bytes], %p)", buffer,
buffer->size, route);
if (buffer->size > (0xffff - sizeof(udp_header)))
return EMSGSIZE;
@ -1029,7 +1033,7 @@ UdpEndpoint::SendRoutedData(net_buffer *buffer, net_route *route)
status_t
UdpEndpoint::SendData(net_buffer *buffer)
{
TRACE_EP("SendData(%p [%lu bytes])", buffer, buffer->size);
TRACE_EP("SendData(%p [%" B_PRIu32 " bytes])", buffer, buffer->size);
return gDatalinkModule->send_data(this, NULL, buffer);
}
@ -1050,14 +1054,15 @@ UdpEndpoint::BytesAvailable()
status_t
UdpEndpoint::FetchData(size_t numBytes, uint32 flags, net_buffer **_buffer)
{
TRACE_EP("FetchData(%ld, 0x%lx)", numBytes, flags);
TRACE_EP("FetchData(%" B_PRIuSIZE ", 0x%" B_PRIx32 ")", numBytes, flags);
status_t status = Dequeue(flags, _buffer);
TRACE_EP(" FetchData(): returned from fifo status: %s", strerror(status));
if (status != B_OK)
return status;
TRACE_EP(" FetchData(): returns buffer with %ld bytes", (*_buffer)->size);
TRACE_EP(" FetchData(): returns buffer with %" B_PRIu32 " bytes",
(*_buffer)->size);
return B_OK;
}
@ -1065,7 +1070,7 @@ UdpEndpoint::FetchData(size_t numBytes, uint32 flags, net_buffer **_buffer)
status_t
UdpEndpoint::StoreData(net_buffer *buffer)
{
TRACE_EP("StoreData(%p [%ld bytes])", buffer, buffer->size);
TRACE_EP("StoreData(%p [%" B_PRIu32 " bytes])", buffer, buffer->size);
return EnqueueClone(buffer);
}
@ -1074,7 +1079,7 @@ UdpEndpoint::StoreData(net_buffer *buffer)
status_t
UdpEndpoint::DeliverData(net_buffer *_buffer)
{
TRACE_EP("DeliverData(%p [%ld bytes])", _buffer, _buffer->size);
TRACE_EP("DeliverData(%p [%" B_PRIu32 " bytes])", _buffer, _buffer->size);
net_buffer *buffer = gBufferModule->clone(_buffer, false);
if (buffer == NULL)
@ -1402,7 +1407,8 @@ err1:
// TODO: shouldn't unregister the protocols here?
delete sUdpEndpointManager;
TRACE_EPM("init_udp() fails with %lx (%s)", status, strerror(status));
TRACE_EPM("init_udp() fails with %" B_PRIx32 " (%s)", status,
strerror(status));
return status;
}