Skip to contentSkip to conversation

Fix: print format type mismatch

PATCH New Mathieu Desnoyers 2 participants 4 messages Dec 2, 2014 – Jan 12, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/4 Fix: print format type mismatch

---
 src/bin/lttng-relayd/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/bin/lttng-relayd/main.c +1 -1
index 27a428a..4be065f 100644
@@ -2321,7 +2321,7 @@ int relay_process_data(struct relay_connection *conn)
 				pthread_mutex_lock(&vstream->overwrite_lock);
 				vstream->abort_flag = 1;
 				pthread_mutex_unlock(&vstream->overwrite_lock);
-				DBG("Streaming side setting abort_flag on stream %s_%lu\n",
+				DBG("Streaming side setting abort_flag on stream %s_%" PRIu64 "\n",
 						stream->channel_name, new_id);
 			} else if (vstream->tracefile_count_current ==
 					stream->tracefile_count_current) {
Signature · 1 line
2.1.1
#2 lore raw

PATCH 3/4 Fix: undefined operation on last_relay_viewer_session_id

In reply to a message not in the archive

Triggers compiler warning on 32-bit build.

---
 src/bin/lttng-relayd/live.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
src/bin/lttng-relayd/live.c +6 -1
index 93d458b..a437d1d 100644
@@ -731,7 +731,12 @@ int viewer_connect(struct relay_connection *conn)
 	reply.major = htobe32(reply.major);
 	reply.minor = htobe32(reply.minor);
 	if (conn->type == RELAY_VIEWER_COMMAND) {
-		reply.viewer_session_id = htobe64(++last_relay_viewer_session_id);
+		/*
+		 * Increment outside of htobe64 macro, because can be used more than once
+		 * within the macro, and thus the operation may be undefined.
+		 */
+		last_relay_viewer_session_id++;
+		reply.viewer_session_id = htobe64(last_relay_viewer_session_id);
 	}
 
 	health_code_update();
Signature · 1 line
2.1.1
#3 lore raw

PATCH 4/4 Fix: tests: integer too large for long type

In reply to a message not in the archive

Compiler warns on 32-bit builds.

---
 tests/unit/test_utils_parse_size_suffix.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/unit/test_utils_parse_size_suffix.c +4 -4
index 2d3bbfc..a950a08 100644
@@ -43,7 +43,7 @@ static struct valid_test_input valid_tests_inputs[] = {
 		{ "128K", 131072 },
 		{ "0x1234k", 4771840 },
 		{ "32M", 33554432 },
-		{ "1024G", 1099511627776 },
+		{ "1024G", 1099511627776ULL },
 		{ "0X400", 1024 },
 		{ "0x40a", 1034 },
 		{ "0X40b", 1035 },
@@ -66,15 +66,15 @@ static struct valid_test_input valid_tests_inputs[] = {
 		{ "0X0K", 0 },
 		{ "0x0M", 0 },
 		{ "0X0G", 0 },
-		{ "0X40G", 68719476736 },
+		{ "0X40G", 68719476736ULL },
 		{ "0300k", 196608 },
 		{ "0300K", 196608 },
 		{ "030M", 25165824 },
-		{ "020G", 17179869184 },
+		{ "020G", 17179869184ULL },
 		{ "0xa0k", 163840 },
 		{ "0xa0K", 163840 },
 		{ "0XA0M", 167772160 },
-		{ "0xA0G", 171798691840 },
+		{ "0xA0G", 171798691840ULL },
 };
 static const int num_valid_tests = sizeof(valid_tests_inputs) / sizeof(valid_tests_inputs[0]);
 
Signature · 1 line
2.1.1
#4 lore raw
In reply to a message not in the archive

Merged the series all the way to 2.4 (except for the first patch, which only makes sense for 2.6+).

Thanks!
Jérémie

Quoted 21 lines · Mathieu Desnoyers
---
 src/bin/lttng-sessiond/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/bin/lttng-sessiond/syscall.c +1 -2
index c38f891..a6f0e1e 100644
@@ -73,7 +73,7 @@ int syscall_init_table(void)
        }
 
        while (fscanf(fp,
-                               "syscall { index = %lu; \
+                               "syscall { index = %zu; \
                                name = %" XSTR(SYSCALL_NAME_LEN) "[^;]; \
                                bitness = %u; };\n",
                                &index, name, &bitness) == 3) {
--

2.1.1

Signature · 8 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev