*
* Copyright 2017 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
*
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * SPDX-License-Identifier: MIT
*
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
*/
#include <stdio.h>
#include <lttng/notification/channel.h>
#include <lttng/notification/notification.h>
#include <lttng/trigger/trigger.h>
+#include <lttng/lttng-error.h>
static unsigned int nr_notifications = 0;
static unsigned int nr_expected_notifications = 0;
const struct lttng_condition *condition,
const struct lttng_evaluation *condition_evaluation);
-int parse_arguments(char **argv) {
+static
+int parse_arguments(char **argv)
+{
const char *domain_type_string = NULL;
const char *buffer_usage_type_string = NULL;
const char *buffer_usage_threshold_type = NULL;
goto end;
}
condition_status = lttng_condition_buffer_usage_set_domain_type(
- condition, LTTNG_DOMAIN_UST);
+ condition, domain_type);
if (condition_status != LTTNG_CONDITION_STATUS_OK) {
printf("error: Could not set domain type\n");
ret = 1;
if (trigger) {
lttng_unregister_trigger(trigger);
}
- lttng_notification_channel_unsubscribe(notification_channel, condition);
+ if (lttng_notification_channel_unsubscribe(notification_channel, condition)) {
+ printf("error: channel unsubscribe error\n");
+ }
lttng_trigger_destroy(trigger);
lttng_condition_destroy(condition);
lttng_action_destroy(action);
}
/* Fetch info to test */
- lttng_condition_buffer_usage_get_session_name(condition,
+ ret = lttng_condition_buffer_usage_get_session_name(condition,
&condition_session_name);
- lttng_condition_buffer_usage_get_channel_name(condition,
+ if (ret) {
+ printf("error: session name could not be fetched\n");
+ ret = 1;
+ goto end;
+ }
+ ret = lttng_condition_buffer_usage_get_channel_name(condition,
&condition_channel_name);
- lttng_condition_buffer_usage_get_domain_type(condition,
+ if (ret) {
+ printf("error: channel name could not be fetched\n");
+ ret = 1;
+ goto end;
+ }
+ ret = lttng_condition_buffer_usage_get_domain_type(condition,
&condition_domain_type);
+ if (ret) {
+ printf("error: domain type could not be fetched\n");
+ ret = 1;
+ goto end;
+ }
if (strcmp(condition_session_name, session_name) != 0) {
printf("error: session name differs\n");