libsysprof-capture: Cut off first 8 bytes of initial counter id

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.
This commit is contained in:
Georges Basile Stavracas Neto
2025-03-31 16:33:34 -03:00
parent 21c9fd4f8c
commit 14af6bab2e

View File

@ -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);