[PATCH] libtraceevent: add flags for tcp state names

From: Song Liu
Date: Thu Nov 09 2017 - 18:30:07 EST


Names of TCP states are added to flags in event-parse.c.

The names are used to print symbolic names in tracepoint:
tcp/tcp_set_state.

Signed-off-by: Song Liu <songliubraving@xxxxxx>
---
tools/lib/traceevent/event-parse.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/even=
t-parse.c
index 7ce724f..4972dc2 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -3790,6 +3790,20 @@ static const struct flag flags[] =3D {

{ "HRTIMER_NORESTART", 0 },
{ "HRTIMER_RESTART", 1 },
+
+ /* tcp state names, see include/net/tcp_states.h */
+ { "TCP_ESTABLISHED", 1 },
+ { "TCP_SYN_SENT", 2 },
+ { "TCP_SYN_RECV", 3 },
+ { "TCP_FIN_WAIT1", 4 },
+ { "TCP_FIN_WAIT2", 5 },
+ { "TCP_TIME_WAIT", 6 },
+ { "TCP_CLOSE", 7 },
+ { "TCP_CLOSE_WAIT", 8 },
+ { "TCP_LAST_ACK", 9 },
+ { "TCP_LISTEN", 10 },
+ { "TCP_CLOSING", 11 },
+ { "TCP_NEW_SYN_RECV", 12 },
};

static long long eval_flag(const char *flag)
--
2.9.5