From: Jérémie Galarneau Date: Wed, 1 Mar 2017 04:02:32 +0000 (-0500) Subject: Add logging to notification API error paths X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=45fdf59176120d64d81b9eb19b0a43ee5d893fcd Add logging to notification API error paths Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/action.c b/src/common/action.c index 7deb509e3..d07f36c2d 100644 --- a/src/common/action.c +++ b/src/common/action.c @@ -17,6 +17,7 @@ #include #include +#include #include enum lttng_action_type lttng_action_get_type(struct lttng_action *action) @@ -97,6 +98,7 @@ ssize_t lttng_action_create_from_buffer(const char *buf, goto end; } + DBG("Deserializing action from buffer"); switch (action_comm->action_type) { case LTTNG_ACTION_TYPE_NOTIFY: action = lttng_action_notify_create(); diff --git a/src/common/buffer-usage.c b/src/common/buffer-usage.c index eed921a56..697967d8c 100644 --- a/src/common/buffer-usage.c +++ b/src/common/buffer-usage.c @@ -18,6 +18,7 @@ #include #include #include +#include #include static @@ -64,12 +65,15 @@ bool lttng_condition_buffer_usage_validate(struct lttng_condition *condition) usage = container_of(condition, struct lttng_condition_buffer_usage, parent); if (!usage->session_name) { + ERR("Invalid buffer condition: a target session name must be set."); goto end; } if (!usage->channel_name) { + ERR("Invalid buffer condition: a target channel name must be set."); goto end; } if (!usage->threshold_percent.set && !usage->threshold_bytes.set) { + ERR("Invalid buffer condition: a threshold must be set."); goto end; } @@ -91,6 +95,7 @@ ssize_t lttng_condition_buffer_usage_serialize(struct lttng_condition *condition goto end; } + DBG("Serializing buffer usage condition"); usage = container_of(condition, struct lttng_condition_buffer_usage, parent); size = sizeof(struct lttng_condition_buffer_usage_comm); @@ -173,6 +178,7 @@ ssize_t init_from_buffer(struct lttng_condition *condition, const char *buf) condition, condition_comm->threshold.percent); } if (status != LTTNG_CONDITION_STATUS_OK) { + ERR("Failed to initialize buffer usage condition threshold"); ret = -1; goto end; } @@ -180,6 +186,8 @@ ssize_t init_from_buffer(struct lttng_condition *condition, const char *buf) if (condition_comm->domain_type <= LTTNG_DOMAIN_NONE || condition_comm->domain_type > LTTNG_DOMAIN_PYTHON) { /* Invalid domain value. */ + ERR("Invalid domain type value (%i) found in condition buffer", + (int) condition_comm->domain_type); ret = -1; goto end; } @@ -188,6 +196,7 @@ ssize_t init_from_buffer(struct lttng_condition *condition, const char *buf) status = lttng_condition_buffer_usage_set_domain_type(condition, domain_type); if (status != LTTNG_CONDITION_STATUS_OK) { + ERR("Failed to set buffer usage condition domain"); ret = -1; goto end; } @@ -198,6 +207,7 @@ ssize_t init_from_buffer(struct lttng_condition *condition, const char *buf) status = lttng_condition_buffer_usage_set_session_name(condition, session_name); if (status != LTTNG_CONDITION_STATUS_OK) { + ERR("Failed to set buffer usage session name"); ret = -1; goto end; } @@ -205,6 +215,7 @@ ssize_t init_from_buffer(struct lttng_condition *condition, const char *buf) status = lttng_condition_buffer_usage_set_channel_name(condition, channel_name); if (status != LTTNG_CONDITION_STATUS_OK) { + ERR("Failed to set buffer usage channel name"); ret = -1; goto end; } @@ -235,6 +246,7 @@ ssize_t lttng_condition_buffer_usage_low_create_from_buffer(const char *buf, goto error; } + DBG("Initializing low buffer usage condition from buffer"); ret = init_from_buffer(condition, buf); if (ret < 0) { goto error; @@ -260,6 +272,7 @@ ssize_t lttng_condition_buffer_usage_high_create_from_buffer(const char *buf, goto error; } + DBG("Initializing high buffer usage condition from buffer"); ret = init_from_buffer(condition, buf); if (ret < 0) { goto error; diff --git a/src/common/condition.c b/src/common/condition.c index 9f9795d55..5c3c11c23 100644 --- a/src/common/condition.c +++ b/src/common/condition.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -99,6 +100,7 @@ ssize_t lttng_condition_create_from_buffer(const char *buf, goto end; } + DBG("Deserializing condition from buffer"); condition_size += sizeof(*condition_comm); buf += condition_size; @@ -120,6 +122,8 @@ ssize_t lttng_condition_create_from_buffer(const char *buf, condition_size += ret; break; default: + ERR("Attempted to create condition of unknown type (%i)", + (int) condition_comm->condition_type); ret = -1; goto end; } diff --git a/src/common/trigger.c b/src/common/trigger.c index 1d79a61a5..12a7329f4 100644 --- a/src/common/trigger.c +++ b/src/common/trigger.c @@ -18,6 +18,7 @@ #include #include #include +#include #include LTTNG_HIDDEN @@ -81,6 +82,7 @@ ssize_t lttng_trigger_create_from_buffer(const char *buf, goto end; } + DBG("Deserializing trigger from buffer"); ret = lttng_condition_create_from_buffer(buf, &condition); if (ret < 0) { goto end;