Fix: erroneous use of kernel consumer error codes
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 29 Mar 2018 20:43:14 +0000 (16:43 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 3 Apr 2018 16:12:29 +0000 (12:12 -0400)
Errors related to the kernel consumer are returned in a code path
that is only used by the userspace tracer, probably as a result
of copy-pasting code.

This patch changes the codes to the corresponding CONSUMER32/64
ones and makes them negative to honor the convention indicated
in the function's header.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/ust-app.c

index 38aeaab60a9399796fbce28080686af087279803..6828660aa537a22e73a23a73c4c38665af03f2fc 100644 (file)
@@ -6334,7 +6334,9 @@ int ust_app_rotate_session(struct ltt_session *session, bool *ust_active)
                                        reg->registry->reg.ust->metadata_key,
                                        LTTNG_DOMAIN_UST, session);
                        if (ret < 0) {
-                               ret = LTTNG_ERR_KERN_CONSUMER_FAIL;
+                               ret = reg->bits_per_long == 32 ?
+                                               -LTTNG_ERR_UST_CONSUMER32_FAIL :
+                                               -LTTNG_ERR_UST_CONSUMER64_FAIL;
                                goto error;
                        }
 
@@ -6353,7 +6355,9 @@ int ust_app_rotate_session(struct ltt_session *session, bool *ust_active)
                                                reg_chan->consumer_key,
                                                LTTNG_DOMAIN_UST, session);
                                if (ret < 0) {
-                                       ret = LTTNG_ERR_KERN_CONSUMER_FAIL;
+                                       ret = reg->bits_per_long == 32 ?
+                                                       -LTTNG_ERR_UST_CONSUMER32_FAIL :
+                                                       -LTTNG_ERR_UST_CONSUMER64_FAIL;
                                        goto error;
                                }
                                ret = consumer_rotate_channel(socket,
@@ -6430,7 +6434,9 @@ int ust_app_rotate_session(struct ltt_session *session, bool *ust_active)
                        ret = rotate_add_channel_pending(registry->metadata_key,
                                        LTTNG_DOMAIN_UST, session);
                        if (ret < 0) {
-                               ret = LTTNG_ERR_KERN_CONSUMER_FAIL;
+                               ret = app->bits_per_long == 32 ?
+                                               -LTTNG_ERR_UST_CONSUMER32_FAIL :
+                                               -LTTNG_ERR_UST_CONSUMER64_FAIL;
                                goto error;
                        }
 
@@ -6441,7 +6447,9 @@ int ust_app_rotate_session(struct ltt_session *session, bool *ust_active)
                                                ua_chan->key, LTTNG_DOMAIN_UST,
                                                session);
                                if (ret < 0) {
-                                       ret = LTTNG_ERR_KERN_CONSUMER_FAIL;
+                                       ret = app->bits_per_long == 32 ?
+                                                       -LTTNG_ERR_UST_CONSUMER32_FAIL :
+                                                       -LTTNG_ERR_UST_CONSUMER64_FAIL;
                                        goto error;
                                }
                                ret = consumer_rotate_channel(socket, ua_chan->key,
This page took 0.029002 seconds and 5 git commands to generate.