Skip to contentSkip to conversation

Fix: assignment from incompatible pointer type warnings

PATCH New Michael Jeanson 2 participants 3 messages Jul 20, 2017 – Jul 21, 2017 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/3 Fix: assignment from incompatible pointer type warnings

On some platforms, mmap returns a caddr_t pointer which generates compiler warnings, cast to the proper pointer type to eliminate them.

---
 src/urcu-bp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
src/urcu-bp.c +5 -3
index 81bb91a..c0fac83 100644
@@ -374,7 +374,8 @@ void expand_arena(struct registry_arena *arena)
 			sizeof(struct registry_chunk)
 			+ sizeof(struct rcu_reader));
 		new_chunk_len = ARENA_INIT_ALLOC;
-		new_chunk = mmap(NULL, new_chunk_len,
+		new_chunk = (struct registry_chunk *) mmap(NULL,
+			new_chunk_len,
 			PROT_READ | PROT_WRITE,
 			MAP_ANONYMOUS | MAP_PRIVATE,
 			-1, 0);
@@ -408,7 +409,8 @@ void expand_arena(struct registry_arena *arena)
 	}
 
 	/* Remap did not succeed, we need to add a new chunk. */
-	new_chunk = mmap(NULL, new_chunk_len,
+	new_chunk = (struct registry_chunk *) mmap(NULL,
+		new_chunk_len,
 		PROT_READ | PROT_WRITE,
 		MAP_ANONYMOUS | MAP_PRIVATE,
 		-1, 0);
@@ -625,7 +627,7 @@ void rcu_bp_exit(void)
 
 		cds_list_for_each_entry_safe(chunk, tmp,
 				&registry_arena.chunk_list, node) {
-			munmap(chunk, chunk->data_len
+			munmap((void *) chunk, chunk->data_len
 					+ sizeof(struct registry_chunk));
 		}
 		CDS_INIT_LIST_HEAD(&registry_arena.chunk_list);
Signature · 6 lines
2.7.4

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#2 lore raw

PATCH 3/3 Tests fix: add missing Cygwin thread id

In reply to a message not in the archive
---
 tests/common/thread-id.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
tests/common/thread-id.h +12 -0
index 96f1f59..cb0d903 100644
@@ -57,6 +57,18 @@ unsigned long urcu_get_thread_id(void)
 {
 	return (unsigned long) pthread_self();
 }
+#elif defined(__CYGWIN__)
+#include <pthread.h>
+
+extern unsigned long pthread_getsequence_np(pthread_t *);
+
+static inline
+unsigned long urcu_get_thread_id(void)
+{
+	pthread_t thr = pthread_self();
+	return pthread_getsequence_np(&thr);
+}
+
 #else
 # warning "use pid as thread ID"
 static inline
Signature · 6 lines
2.7.4

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#3 lore raw

Re: [PATCH urcu 1/3] Tests fix: unused variable warnings

In reply to a message not in the archive

Merged into master, 0.10, 0.9, 0.8, thanks!

Mathieu

Quoted 25 lines · ----- On Jul 20, 2017, at 5:33 PM, Michael Jeanson [email protected] wrote:

---
tests/benchmark/test_urcu_lfs_rcu.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
tests/benchmark/test_urcu_lfs_rcu.c +3 -3
index ce01143..9e0bfad 100644
@@ -83,9 +83,10 @@ pthread_mutex_t affinity_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static void set_affinity(void)
 {
+#if HAVE_SCHED_SETAFFINITY
 	cpu_set_t mask;
-	int cpu;
-	int ret;
+	int cpu, ret;
+#endif /* HAVE_SCHED_SETAFFINITY */
 
 	if (!use_affinity)
 		return;
--

2.7.4

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev