X-Git-Url: http://git.lttng.org/?p=lttng-modules.git;a=blobdiff_plain;f=instrumentation%2Fevents%2Flttng-module%2Frpc.h;h=ceaf9dbf4089f6b00c1ebf3ace7b5eedd374330f;hp=2d06e5578c968551079af19db196f42a2ba2cd09;hb=b6903d57e4c3234ec5b1c7f72e232023cdee0fab;hpb=70389e422dd3146161089d454f525367c9046ecd diff --git a/instrumentation/events/lttng-module/rpc.h b/instrumentation/events/lttng-module/rpc.h index 2d06e557..ceaf9dbf 100644 --- a/instrumentation/events/lttng-module/rpc.h +++ b/instrumentation/events/lttng-module/rpc.h @@ -9,6 +9,29 @@ #include #include +#ifndef ONCE_LTTNG_RPC_H +#define ONCE_LTTNG_RPC_H + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) +static inline +int lttng_get_clid(const struct rpc_task *task) +{ + struct rpc_clnt *tk_client; + + tk_client = task->tk_client; + if (!tk_client) + return -1; + /* + * The cl_clid field is always initialized to positive signed + * integers. Negative signed integer values are treated as + * errors. + */ + return (int) tk_client->cl_clid; +} +#endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ + +#endif /* ONCE_LTTNG_RPC_H */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0)) LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status, @@ -18,7 +41,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(int, client_id, task->tk_client->cl_clid) + ctf_integer(int, client_id, lttng_get_clid(task)) ctf_integer(int, status, task->tk_status) ) ) @@ -43,7 +66,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(int, client_id, task->tk_client->cl_clid) + ctf_integer(int, client_id, lttng_get_clid(task)) ctf_integer(int, status, task->tk_status) ) ) @@ -100,7 +123,7 @@ LTTNG_TRACEPOINT_EVENT(rpc_connect_status, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(int, client_id, task->tk_client->cl_clid) + ctf_integer(int, client_id, lttng_get_clid(task)) ctf_integer(int, status, task->tk_status) ) ) @@ -112,7 +135,7 @@ LTTNG_TRACEPOINT_EVENT(rpc_connect_status, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(int, client_id, task->tk_client->cl_clid) + ctf_integer(int, client_id, lttng_get_clid(task)) ctf_integer(int, status, status) ) ) @@ -139,8 +162,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(int, client_id, task->tk_client ? - task->tk_client->cl_clid : -1) + ctf_integer(int, client_id, lttng_get_clid(task)) ctf_integer_hex(const void *, action, action) ctf_integer(unsigned long, runstate, task->tk_runstate) ctf_integer(int, status, task->tk_status) @@ -177,8 +199,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(int, client_id, task->tk_client ? - task->tk_client->cl_clid : -1) + ctf_integer(int, client_id, lttng_get_clid(task)) ctf_integer(unsigned long, timeout, task->tk_timeout) ctf_integer(unsigned long, runstate, task->tk_runstate) ctf_integer(int, status, task->tk_status) @@ -210,8 +231,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(int, client_id, task->tk_client ? - task->tk_client->cl_clid : -1) + ctf_integer(int, client_id, lttng_get_clid(task)) ctf_integer_hex(const void *, action, action) ctf_integer(unsigned long, runstate, task->tk_runstate) ctf_integer(int, status, task->tk_status) @@ -248,8 +268,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued, TP_FIELDS( ctf_integer(unsigned int, task_id, task->tk_pid) - ctf_integer(int, client_id, task->tk_client ? - task->tk_client->cl_clid : -1) + ctf_integer(int, client_id, lttng_get_clid(task)) ctf_integer(unsigned long, timeout, task->tk_timeout) ctf_integer(unsigned long, runstate, task->tk_runstate) ctf_integer(int, status, task->tk_status)