[lttng-dev] [PATCH babeltrace] Fix: warnings on Solaris10

Jérémie Galarneau jeremie.galarneau at efficios.com
Thu May 5 21:24:51 UTC 2016


Merged, thanks!

Jérémie

On Wed, May 4, 2016 at 1:02 PM, Michael Jeanson <mjeanson at efficios.com> wrote:
> Cast values to uint64_t before passing them to htobe64() because
> the implementation on Solaris10 uses bitshifts and will complain
> when passed 32bits values.
>
> This fixes multiple warnings like:
>
> lttng-live-comm.c:169:2: warning: left shift count >= width of type
>   cmd.data_size = htobe64(sizeof(connect));
>
> Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
> ---
>  formats/lttng-live/lttng-live-comm.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/formats/lttng-live/lttng-live-comm.c b/formats/lttng-live/lttng-live-comm.c
> index bfcef69..1912b57 100644
> --- a/formats/lttng-live/lttng-live-comm.c
> +++ b/formats/lttng-live/lttng-live-comm.c
> @@ -166,7 +166,7 @@ int lttng_live_establish_connection(struct lttng_live_ctx *ctx)
>         }
>
>         cmd.cmd = htobe32(LTTNG_VIEWER_CONNECT);
> -       cmd.data_size = htobe64(sizeof(connect));
> +       cmd.data_size = htobe64((uint64_t) sizeof(connect));
>         cmd.cmd_version = htobe32(0);
>
>         connect.viewer_session_id = -1ULL;      /* will be set on recv */
> @@ -307,7 +307,7 @@ int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path)
>         }
>
>         cmd.cmd = htobe32(LTTNG_VIEWER_LIST_SESSIONS);
> -       cmd.data_size = htobe64(0);
> +       cmd.data_size = htobe64((uint64_t) 0);
>         cmd.cmd_version = htobe32(0);
>
>         ret_len = lttng_live_send(ctx->control_sock, &cmd, sizeof(cmd));
> @@ -432,7 +432,7 @@ int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id)
>         }
>
>         cmd.cmd = htobe32(LTTNG_VIEWER_ATTACH_SESSION);
> -       cmd.data_size = htobe64(sizeof(rq));
> +       cmd.data_size = htobe64((uint64_t) sizeof(rq));
>         cmd.cmd_version = htobe32(0);
>
>         memset(&rq, 0, sizeof(rq));
> @@ -662,7 +662,7 @@ retry:
>         }
>
>         cmd.cmd = htobe32(LTTNG_VIEWER_GET_PACKET);
> -       cmd.data_size = htobe64(sizeof(rq));
> +       cmd.data_size = htobe64((uint64_t) sizeof(rq));
>         cmd.cmd_version = htobe32(0);
>
>         memset(&rq, 0, sizeof(rq));
> @@ -814,7 +814,7 @@ int get_one_metadata_packet(struct lttng_live_ctx *ctx,
>
>         rq.stream_id = htobe64(metadata_stream->id);
>         cmd.cmd = htobe32(LTTNG_VIEWER_GET_METADATA);
> -       cmd.data_size = htobe64(sizeof(rq));
> +       cmd.data_size = htobe64((uint64_t) sizeof(rq));
>         cmd.cmd_version = htobe32(0);
>
>         ret_len = lttng_live_send(ctx->control_sock, &cmd, sizeof(cmd));
> @@ -989,7 +989,7 @@ int get_next_index(struct lttng_live_ctx *ctx,
>         struct lttng_viewer_index *rp = &viewer_stream->current_index;
>
>         cmd.cmd = htobe32(LTTNG_VIEWER_GET_NEXT_INDEX);
> -       cmd.data_size = htobe64(sizeof(rq));
> +       cmd.data_size = htobe64((uint64_t) sizeof(rq));
>         cmd.cmd_version = htobe32(0);
>
>         memset(&rq, 0, sizeof(rq));
> @@ -1332,7 +1332,7 @@ int lttng_live_create_viewer_session(struct lttng_live_ctx *ctx)
>         }
>
>         cmd.cmd = htobe32(LTTNG_VIEWER_CREATE_SESSION);
> -       cmd.data_size = htobe64(0);
> +       cmd.data_size = htobe64((uint64_t) 0);
>         cmd.cmd_version = htobe32(0);
>
>         ret_len = lttng_live_send(ctx->control_sock, &cmd, sizeof(cmd));
> @@ -1522,7 +1522,7 @@ int lttng_live_get_new_streams(struct lttng_live_ctx *ctx, uint64_t id)
>         }
>
>         cmd.cmd = htobe32(LTTNG_VIEWER_GET_NEW_STREAMS);
> -       cmd.data_size = htobe64(sizeof(rq));
> +       cmd.data_size = htobe64((uint64_t) sizeof(rq));
>         cmd.cmd_version = htobe32(0);
>
>         memset(&rq, 0, sizeof(rq));
> --
> 2.7.4
>



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list