Validate channel context mismatch across UST applications
[lttng-tools.git] / src / bin / lttng-sessiond / ust-field-utils.cpp
index a89fade5ec93254c237a73a0d45e991e7a5e947e..a8f3da2ba7a96c088d54f373962e56311033697b 100644 (file)
@@ -338,3 +338,33 @@ int match_lttng_ust_ctl_field(const struct lttng_ust_ctl_field *first,
 no_match:
        return false;
 }
+
+/*
+ * Compare two arrays of UST fields.
+ * Return true if both arrays have identical field definitions, false otherwise.
+ */
+bool match_lttng_ust_ctl_field_array(const struct lttng_ust_ctl_field *first,
+               size_t nr_first,
+               const struct lttng_ust_ctl_field *second,
+               size_t nr_second)
+{
+       size_t i;
+       const size_t nr_fields = nr_first;
+
+       /* Compare the array lengths. */
+       if (nr_first != nr_second) {
+               goto no_match;
+       }
+
+       /* Compare each field individually. */
+       for (i = 0; i < nr_fields; i++) {
+               if (!match_lttng_ust_ctl_field(&first[i], &second[i])) {
+                       goto no_match;
+               }
+       }
+
+       return true;
+
+no_match:
+       return false;
+}
This page took 0.023973 seconds and 4 git commands to generate.