Fix: report to client when snapshot will be empty
[lttng-tools.git] / src / bin / lttng-sessiond / ust-app.c
index d1fa0d09cb2b04d75b3419cd6fa969a602253eb0..34d4c9b1558de816bd1935ba02eef50b1c90e511 100644 (file)
@@ -4932,6 +4932,7 @@ int ust_app_snapshot_record(struct ltt_ust_session *usess,
                struct snapshot_output *output, int wait, unsigned int nb_streams)
 {
        int ret = 0;
                struct snapshot_output *output, int wait, unsigned int nb_streams)
 {
        int ret = 0;
+       unsigned int snapshot_done = 0;
        struct lttng_ht_iter iter;
        struct ust_app *app;
        char pathname[PATH_MAX];
        struct lttng_ht_iter iter;
        struct ust_app *app;
        char pathname[PATH_MAX];
@@ -5006,6 +5007,7 @@ int ust_app_snapshot_record(struct ltt_ust_session *usess,
                        if (ret < 0) {
                                goto error;
                        }
                        if (ret < 0) {
                                goto error;
                        }
+                       snapshot_done = 1;
                }
                break;
        }
                }
                break;
        }
@@ -5073,6 +5075,7 @@ int ust_app_snapshot_record(struct ltt_ust_session *usess,
                        if (ret < 0) {
                                goto error;
                        }
                        if (ret < 0) {
                                goto error;
                        }
+                       snapshot_done = 1;
                }
                break;
        }
                }
                break;
        }
@@ -5081,6 +5084,15 @@ int ust_app_snapshot_record(struct ltt_ust_session *usess,
                break;
        }
 
                break;
        }
 
+       if (!snapshot_done) {
+               /*
+                * If no snapshot was made and we are not in the error path, this means
+                * that there are no buffers thus no (prior) application to snapshot
+                * data from so we have simply NO data.
+                */
+               ret = -ENODATA;
+       }
+
 error:
        rcu_read_unlock();
        return ret;
 error:
        rcu_read_unlock();
        return ret;
This page took 0.023642 seconds and 4 git commands to generate.