+end:
+ return BT_CB_OK;
+
+error:
+ return BT_CB_ERROR_STOP;
+}
+
+enum bt_cb_ret handle_statedump_file_descriptor(struct bt_ctf_event *call_data,
+ void *private_data)
+{
+ const struct bt_definition *scope;
+ struct processtop *parent;
+ struct files *file;
+ unsigned long timestamp;
+ int64_t pid;
+ char *file_name, *hostname;
+ int fd;
+
+ timestamp = bt_ctf_get_timestamp(call_data);
+ if (timestamp == -1ULL)
+ goto error;
+
+ scope = bt_ctf_get_top_level_scope(call_data,
+ BT_EVENT_FIELDS);
+ pid = bt_ctf_get_int64(bt_ctf_get_field(call_data,
+ scope, "_pid"));
+ if (bt_ctf_field_get_error()) {
+ fprintf(stderr, "Missing tid context info\n");
+ goto error;
+ }
+
+ scope = bt_ctf_get_top_level_scope(call_data,
+ BT_EVENT_FIELDS);
+ fd = bt_ctf_get_int64(bt_ctf_get_field(call_data,
+ scope, "_fd"));
+ if (bt_ctf_field_get_error()) {
+ fprintf(stderr, "Missing fd context info\n");
+ goto error;
+ }
+
+ scope = bt_ctf_get_top_level_scope(call_data,
+ BT_EVENT_FIELDS);
+ file_name = bt_ctf_get_string(bt_ctf_get_field(call_data,
+ scope, "_filename"));
+ if (bt_ctf_field_get_error()) {
+ fprintf(stderr, "Missing file name context info\n");
+ goto error;
+ }
+ hostname = get_context_hostname(call_data);
+
+ parent = get_proc_pid(<tngtop, pid, pid, timestamp, hostname);
+ if (!parent)
+ goto end;
+
+ parent->files_history = create_file(parent->files_history, file_name);
+ file = parent->files_history->file;
+ edit_file(parent, file, fd);
+
+end: