[lttng-dev] [lttng-tools PATCH] lttng-sessiond: do not call ustctl_register_done()

David Goulet david.goulet at polymtl.ca
Mon Jan 9 14:22:42 EST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I changed a typo in the patch:

ust_ctl_register_done --> ustctl_register_done

and added your signed off:

- --> Signed-off-by: Gerlando Falauto <gerlando.falauto at keymile.com>

Merged and pushed!

Thanks a lot
David

On 12-01-05 06:25 AM, Gerlando Falauto wrote:
> 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).
> ---
>  lttng-sessiond/main.c    |    2 +-
>  lttng-sessiond/ust-app.h |   10 ++++++++++
>  2 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c
> index 84cff5b..7523a17 100644
> --- a/lttng-sessiond/main.c
> +++ b/lttng-sessiond/main.c
> @@ -1164,7 +1164,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 0c753ab..d05bf11 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 ust_ctl_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)
>  {
>  }
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJPCz6CAAoJEELoaioR9I02aIoH/3P0XhW2OEZfeoEcvKuCxTKe
TFsXrBLJB5SZuytBEgiwoviKbjw7ms3A4/c6dm8VGFu6yvK70VRp8oUBT8USlOaj
HblTe0VP/9EkirM6Wqg+7IQYIB2MbKa7o2wXqL+kZBrh0CErRPKaDXvcGmFU0ZU1
YPwqZ+lNqFFmMV+N7PlBlGLU7YllHNJ6lcbt75uqtprxipm0Jv/hpa8Cxc8JdX/m
FEkIZXooHfplt9PaekjSeumW4QnoxFIUYKmjKNLnttEStiorRGspD4iJA3U4OmE3
pdkO5pe2fLftDc9avcYaARH4INsunLFZuVAOEMa/QEkdSCugv8LAaY04IdFgAvc=
=Vn4/
-----END PGP SIGNATURE-----



More information about the lttng-dev mailing list