Commit 360c1c13 authored by Pavel Emelyanov's avatar Pavel Emelyanov

tcp: Show tcp queues contents when requested

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 008d3a98
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "uts_ns.h" #include "uts_ns.h"
#include "ipc_ns.h" #include "ipc_ns.h"
#include "pstree.h" #include "pstree.h"
#include "cr-show.h"
#include "protobuf.h" #include "protobuf.h"
#include "protobuf/pstree.pb-c.h" #include "protobuf/pstree.pb-c.h"
...@@ -300,7 +301,7 @@ static struct show_image_info show_infos[] = { ...@@ -300,7 +301,7 @@ static struct show_image_info show_infos[] = {
SHOW_PLAIN(RLIMIT), SHOW_PLAIN(RLIMIT),
SHOW_PLAIN(TUNFILE), SHOW_PLAIN(TUNFILE),
{ TCP_STREAM_MAGIC, PB_TCP_STREAM, true, NULL, "1:%u 2:%u 3:%u 4:%u", }, { TCP_STREAM_MAGIC, PB_TCP_STREAM, true, show_tcp_stream, "1:%u 2:%u 3:%u 4:%u", },
{ STATS_MAGIC, PB_STATS, true, NULL, "1.1:%u 1.2:%u 1.3:%u 1.4:%u 1.5:%Lu 1.6:%Lu 1.7:%Lu", }, { STATS_MAGIC, PB_STATS, true, NULL, "1.1:%u 1.2:%u 1.3:%u 1.4:%u 1.5:%Lu 1.6:%Lu 1.7:%Lu", },
{ FDINFO_MAGIC, PB_FDINFO, false, NULL, "flags:%#o fd:%d", }, { FDINFO_MAGIC, PB_FDINFO, false, NULL, "flags:%#o fd:%d", },
{ UNIXSK_MAGIC, PB_UNIX_SK, false, NULL, "1:%#x 2:%#x 3:%d 4:%d 5:%d 6:%d 7:%d 8:%#x 11:S", }, { UNIXSK_MAGIC, PB_UNIX_SK, false, NULL, "1:%#x 2:%#x 3:%d 4:%d 5:%d 6:%d 7:%d 8:%#x 11:S", },
......
...@@ -16,4 +16,5 @@ extern void ipc_shm_handler(int fd, void *obj); ...@@ -16,4 +16,5 @@ extern void ipc_shm_handler(int fd, void *obj);
extern void ipc_msg_handler(int fd, void *obj); extern void ipc_msg_handler(int fd, void *obj);
extern void ipc_sem_handler(int fd, void *obj); extern void ipc_sem_handler(int fd, void *obj);
extern int cr_parse_fd(int fd, u32 magic); extern int cr_parse_fd(int fd, u32 magic);
extern void show_tcp_stream(int fd, void *obj);
#endif /* __CR_SHOW_H__ */ #endif /* __CR_SHOW_H__ */
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "namespaces.h" #include "namespaces.h"
#include "xmalloc.h" #include "xmalloc.h"
#include "config.h" #include "config.h"
#include "cr-show.h"
#include "protobuf.h" #include "protobuf.h"
#include "protobuf/tcp-stream.pb-c.h" #include "protobuf/tcp-stream.pb-c.h"
...@@ -635,3 +636,14 @@ out: ...@@ -635,3 +636,14 @@ out:
return ret; return ret;
} }
void show_tcp_stream(int fd, void *obj)
{
TcpStreamEntry *e = obj;
if (opts.show_pages_content) {
pr_msg("In-queue:");
print_image_data(fd, e->inq_len, 1);
pr_msg("Out-queue:");
print_image_data(fd, e->outq_len, 1);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment