[CRIU] [PATCH 4/6] socket options: add protobuf "pretty show" array

Kinsbursky Stanislav skinsbursky at openvz.org
Fri Jul 27 10:06:46 EDT 2012


Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>

---
 sockets.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/sockets.c b/sockets.c
index 00cc7cd..253c869 100644
--- a/sockets.c
+++ b/sockets.c
@@ -378,6 +378,45 @@ char *skstate2s(u32 state)
 		return unknown(state);
 }
 
+static void show_sndbuf(void *ptr, void *arg)
+{
+       pr_msg("sndbuf: %u  ", *(unsigned int *)ptr);
+}
+
+static void show_rcvbuf(void *ptr, void *arg)
+{
+       pr_msg("sndbuf: %u  ", *(unsigned int *)ptr);
+}
+
+static void show_snd_tmo_sec(void *ptr, void *arg)
+{
+       pr_msg("sndtmo: %lu.", *(unsigned long *)ptr);
+}
+
+static void show_snd_tmo_usec(void *ptr, void *arg)
+{
+       pr_msg("%lu  ", *(unsigned long *)ptr);
+}
+
+static void show_rcv_tmo_sec(void *ptr, void *arg)
+{
+       pr_msg("rcvtmo: %lu.", *(unsigned long *)ptr);
+}
+
+static void show_rcv_tmo_usec(void *ptr, void *arg)
+{
+       pr_msg("%lu  ", *(unsigned long *)ptr);
+}
+
+pb_pr_field_t socket_ops_pretty_array[] = {
+       [0] = show_sndbuf,
+       [1] = show_rcvbuf,
+       [2] = show_snd_tmo_sec,
+       [3] = show_snd_tmo_usec,
+       [4] = show_rcv_tmo_sec,
+       [5] = show_rcv_tmo_usec,
+};
+
 void show_socket_opts(SkOptsEntry *soe)
 {
 	pr_msg("\t");



More information about the CRIU mailing list