[lttng-dev] [PATCH] Java Agent: Make the agent protocol consistently network endian

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Fri Oct 23 17:58:51 EDT 2015


Merged into UST master, thanks!

Mathieu

----- On Oct 23, 2015, at 5:12 PM, Jeremie Galarneau jeremie.galarneau at efficios.com wrote:

> Considering the Agent Protocol is bumped to v2.0 as of 2.8.x,
> this patch revisits the unfortunate decision of communicating
> in host-endianness from the session daemon to the agents, and
> in big endian from the agents to the session daemon.
> 
> This change does not affect the Python agent which was erroneously
> (although quite reasonably) assuming communications were occurring
> in network endianness.
> 
> Signed-off-by: Jérémie Galarneau <jeremie.galarneau at efficios.com>
> ---
> .../org/lttng/ust/agent/client/SessiondDisableEventCommand.java         | 2 +-
> .../org/lttng/ust/agent/client/SessiondEnableEventCommand.java          | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git
> a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondDisableEventCommand.java
> b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondDisableEventCommand.java
> index 03cd9de..2956c7e 100644
> ---
> a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondDisableEventCommand.java
> +++
> b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondDisableEventCommand.java
> @@ -38,7 +38,7 @@ class SessiondDisableEventCommand implements ISessiondCommand
> {
> 			throw new IllegalArgumentException();
> 		}
> 		ByteBuffer buf = ByteBuffer.wrap(data);
> -		buf.order(ByteOrder.LITTLE_ENDIAN);
> +		buf.order(ByteOrder.BIG_ENDIAN);
> 		eventName = new String(data).trim();
> 	}
> 
> diff --git
> a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondEnableEventCommand.java
> b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondEnableEventCommand.java
> index c9183d1..5665a69 100644
> ---
> a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondEnableEventCommand.java
> +++
> b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondEnableEventCommand.java
> @@ -48,7 +48,7 @@ class SessiondEnableEventCommand implements ISessiondCommand {
> 			throw new IllegalArgumentException();
> 		}
> 		ByteBuffer buf = ByteBuffer.wrap(data);
> -		buf.order(ByteOrder.LITTLE_ENDIAN);
> +		buf.order(ByteOrder.BIG_ENDIAN);
> 		int logLevel = buf.getInt();
> 		int logLevelType = buf.getInt();
> 		logLevelFilter = new LogLevelSelector(logLevel, logLevelType);
> --
> 2.6.2

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list