From: Gerlando Falauto Date: Thu, 5 Jan 2012 11:25:29 +0000 (+0100) Subject: lttng-sessiond: do not call ustctl_register_done() X-Git-Tag: v2.0-pre17~33 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=f2ca2e251d8f49b0dbbcca529dd61b3562c1147f;ds=sidebyside lttng-sessiond: do not call ustctl_register_done() When lttng-ust support is not enabled, compilation might fail with: lttng-tools.git/lttng-sessiond/main.c:1167: undefined reference to `ustctl_register_done' Actually when HAVE_LIBLTTNG_UST_CTL is not defined, the function call is normally optimized out by the compiler because ust_app_register() is a static inline alway returning a negative value, leaving the call within unreachable code. Depending on the compiler version and optimization flags, this may however not always happen, leading to the above error. Therefore replace ustctl_register_done() with ustapp_register_done(), which calls the original function when lttng-ust is enabled, and returns an error otherwise (it is unreachable code anyway). Signed-off-by: Gerlando Falauto Signed-off-by: David Goulet --- diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index 845ec0684..91db9677a 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -1157,7 +1157,7 @@ static void *thread_manage_apps(void *data) */ update_ust_app(ust_cmd.sock); - ret = ustctl_register_done(ust_cmd.sock); + ret = ust_app_register_done(ust_cmd.sock); if (ret < 0) { /* * If the registration is not possible, we simply diff --git a/lttng-sessiond/ust-app.h b/lttng-sessiond/ust-app.h index 8cc049aef..071ad0d90 100644 --- a/lttng-sessiond/ust-app.h +++ b/lttng-sessiond/ust-app.h @@ -119,6 +119,11 @@ struct ust_app { #ifdef HAVE_LIBLTTNG_UST_CTL int ust_app_register(struct ust_register_msg *msg, int sock); +static inline +int ust_app_register_done(int sock) +{ + return ustctl_register_done(sock); +} void ust_app_unregister(int sock); unsigned long ust_app_list_count(void); int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app); @@ -195,6 +200,11 @@ int ust_app_register(struct ust_register_msg *msg, int sock) return -ENOSYS; } static inline +int ust_app_register_done(int sock) +{ + return -ENOSYS; +} +static inline void ust_app_unregister(int sock) { }