From 14af6bab2eac9decbdd5427317f00443549b3bd3 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 31 Mar 2025 16:33:34 -0300 Subject: [PATCH] libsysprof-capture: Cut off first 8 bytes of initial counter id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures that the id won't be screwed by the 32 → 24 bit conversion that happens implicitly when using SysprofCaptureCounter & family of structs. These structs are tightly packed and declare the id field as a 24-bit unsigned, which doesn't necessarily match the counting that is done via SysprofCollector. This is by no means a definitive solution, but this gets things in a more usable state until a better solution is implemented. --- src/libsysprof-capture/sysprof-collector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsysprof-capture/sysprof-collector.c b/src/libsysprof-capture/sysprof-collector.c index e41e8018..454c1109 100644 --- a/src/libsysprof-capture/sysprof-collector.c +++ b/src/libsysprof-capture/sysprof-collector.c @@ -424,7 +424,7 @@ sysprof_collector_get (void) #else self->tid = self->pid; #endif - self->next_counter_id = ((unsigned)self->pid << 16); + self->next_counter_id = (((unsigned)self->pid << 16) >> 8); pthread_mutex_lock (&control_fd_lock);