Handle sys_socket
authorJulien Desfossez <jdesfossez@efficios.com>
Wed, 12 Feb 2014 03:05:26 +0000 (22:05 -0500)
committerJulien Desfossez <jdesfossez@efficios.com>
Wed, 12 Feb 2014 03:05:26 +0000 (22:05 -0500)
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 <dgoulet@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
src/iostreamtop.c
src/iostreamtop.h
src/lttngtop.c

index 367fdee6ef2e281c2cbcbde3bc0019b74872ac08..f20fcecd81ec752a88b6ddf25559ab82d752aa81 100644 (file)
@@ -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(&lttngtop, 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)
index 0124ac6455a780bd6f4ce668100ca8162989cec5..96313c5abd9b8cb03e108ed05cd261d622b31b2c 100644 (file)
@@ -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,
index 173cc82e7facdb85f15bd0463710cac4fb56594b..27bf8c8cb8c5b6608b53f98af8eda405db980e78 100644 (file)
@@ -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);
This page took 0.033686 seconds and 4 git commands to generate.