Two issues:
1. when writing out the function name length, don't just write the 4 MSB
of the size
2. when reading the time, don't just use the 4 MSB of the time as the
timestamp; the log contains a full time_t, so we may as well use it.
This is to allow for the header (16bytes and variable length function).
so if someone has a function name > 400 chars it will break. I
recon that will do:)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
On little endian architectures where time_t is 64-bit long integer could
happen, that instead of displaying correct timestamp, random data was
used, because of memcpy.
Solution is to memcpy to real 32-bit variable and then assing this value
to timestamp. This will let compiler decide endianity and store number
correctly.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
* lib/log_blackbox.c (qb_log_blackbox_print_from_file): Handle
localtime failure by printing the long-int representation rather
than a strftime-formatted one.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
I think in most cases tags will not be used and it will
just be a pain inserting ", 0". But if someone wants to use
tags like this then they still can via qb_logt()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
1) use gettimeofday() - suprisingly faster than clock_gettime(MONOTONIC)
2) don't format the time until it is needed
3) insert time_t into the blackbox (not a formatted string)
This improves performance and tidies the code up.
It also requires less space in the blackbox.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>