Validate channel context mismatch across UST applications
[lttng-tools.git] / src / bin / lttng-sessiond / ust-field-utils.c
index 954581d3ce85cf6dfdfb3c53fa06bd82f6865c20..cef0261564c9034beef23846bd9d23b1521e4144 100644 (file)
@@ -278,3 +278,33 @@ int match_ustctl_field(const struct ustctl_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 ustctl_field *first,
+               size_t nr_first,
+               const struct ustctl_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_ustctl_field(&first[i], &second[i])) {
+                       goto no_match;
+               }
+       }
+
+       return true;
+
+no_match:
+       return false;
+}
This page took 0.024564 seconds and 5 git commands to generate.