From: Julien Desfossez Date: Wed, 12 Feb 2014 03:05:26 +0000 (-0500) Subject: Handle sys_socket X-Git-Tag: v0.3~35 X-Git-Url: http://git.lttng.org/?p=lttngtop.git;a=commitdiff_plain;h=9f2856ad8e6efb7b5c1db062babb1276242dd444 Handle sys_socket Just set the filename to "socket" when we receive a sys_socket, we don't have much more information at this point, but at least it gives the user some information. Reported-by: David Goulet Signed-off-by: Julien Desfossez --- diff --git a/src/iostreamtop.c b/src/iostreamtop.c index 367fdee..f20fcec 100644 --- a/src/iostreamtop.c +++ b/src/iostreamtop.c @@ -400,7 +400,6 @@ error: return BT_CB_ERROR_STOP; } - enum bt_cb_ret handle_sys_open(struct bt_ctf_event *call_data, void *private_data) { @@ -447,6 +446,43 @@ error: return BT_CB_ERROR_STOP; } +enum bt_cb_ret handle_sys_socket(struct bt_ctf_event *call_data, + void *private_data) +{ + + struct processtop *tmp; + unsigned long timestamp; + uint64_t cpu_id; + int64_t tid; + char *procname, *hostname; + char *file; + + timestamp = bt_ctf_get_timestamp(call_data); + if (timestamp == -1ULL) + goto error; + + tid = get_context_tid(call_data); + cpu_id = get_cpu_id(call_data); + + procname = get_context_comm(call_data); + hostname = get_context_hostname(call_data); + + file = strdup("socket"); + + tmp = get_proc(<tngtop, tid, procname, timestamp, hostname); + if (!tmp) + goto end; + + tmp->syscall_info = create_syscall_info(__NR_open, cpu_id, tid, -1); + + tmp->files_history = create_file(tmp->files_history, file); + +end: + return BT_CB_OK; + +error: + return BT_CB_ERROR_STOP; +} enum bt_cb_ret handle_sys_close(struct bt_ctf_event *call_data, void *private_data) diff --git a/src/iostreamtop.h b/src/iostreamtop.h index 0124ac6..96313c5 100644 --- a/src/iostreamtop.h +++ b/src/iostreamtop.h @@ -36,6 +36,8 @@ enum bt_cb_ret handle_sys_read(struct bt_ctf_event *call_data, void *private_data); enum bt_cb_ret handle_sys_open(struct bt_ctf_event *call_data, void *private_data); +enum bt_cb_ret handle_sys_socket(struct bt_ctf_event *call_data, + void *private_data); enum bt_cb_ret handle_sys_close(struct bt_ctf_event *call_data, void *private_data); enum bt_cb_ret handle_statedump_file_descriptor(struct bt_ctf_event *call_data, diff --git a/src/lttngtop.c b/src/lttngtop.c index 173cc82..27bf8c8 100644 --- a/src/lttngtop.c +++ b/src/lttngtop.c @@ -908,6 +908,9 @@ void iter_trace(struct bt_context *bt_ctx) bt_ctf_iter_add_callback(iter, g_quark_from_static_string("sys_open"), NULL, 0, handle_sys_open, NULL, NULL, NULL); + bt_ctf_iter_add_callback(iter, + g_quark_from_static_string("sys_socket"), + NULL, 0, handle_sys_socket, NULL, NULL, NULL); bt_ctf_iter_add_callback(iter, g_quark_from_static_string("sys_close"), NULL, 0, handle_sys_close, NULL, NULL, NULL);