aboutsummaryrefslogtreecommitdiff
path: root/sysconfigs
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2013-01-25 16:43:37 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2013-02-05 21:52:55 +0100
commitfb3a508531227bc7fb7eee22c51d30bf2ceb15f5 (patch)
tree3268eb2172742e5779ddd1c8e1cd34f6d6094afd /sysconfigs
parentb22dd1243f38286263d40496ce5298a8a7d96eea (diff)
trace: Fix simple trace dropped event record for big endian
We use atomic operations to keep track of dropped events. Inconveniently, GLib supports only int and void * atomics, but the counter dropped_events is uint64_t. Can't stop commit 62bab732: a quick (gint *)&dropped_events bludgeons the compiler into submission. That cast is okay only when int is exactly 64 bits wide, which it commonly isn't. If int is even wider, we clobber whatever follows dropped_events. Not worth worrying about, as none of the machines that interest us have such morbidly obese ints. That leaves the common case: int narrower than 64 bits. Harmless on little endian hosts: we just don't access the most significant bits of dropped_events. They remain zero. On big endian hosts, we use only the most significant bits of dropped_events as counter. The least significant bits remain zero. However, we write out the full value, which is the correct counter shifted left a bunch of places. Fix by changing the variables involved to int. There's another, equally suspicious-looking (gint *)&trace_idx argument to g_atomic_int_compare_and_exchange(), but that one casts unsigned *, so it's okay. But it's also superfluous, because GLib's atomic int operations work just fine for unsigned. Drop it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'sysconfigs')
0 files changed, 0 insertions, 0 deletions