projects
/
lttng-modules.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix: use timespec64 on kernels that have it
[lttng-modules.git]
/
lttng-events.c
diff --git
a/lttng-events.c
b/lttng-events.c
index ee0e7f9056a9a594cb9be70763077fe2598199f7..3d0ef98464cfdfa0c2bec1040b8b52159fa0dcf6 100644
(file)
--- a/
lttng-events.c
+++ b/
lttng-events.c
@@
-56,6
+56,7
@@
#include <wrapper/vzalloc.h>
#include <wrapper/ringbuffer/backend.h>
#include <wrapper/ringbuffer/frontend.h>
#include <wrapper/vzalloc.h>
#include <wrapper/ringbuffer/backend.h>
#include <wrapper/ringbuffer/frontend.h>
+#include <wrapper/time.h>
#define METADATA_CACHE_DEFAULT_SIZE 4096
#define METADATA_CACHE_DEFAULT_SIZE 4096
@@
-2415,6
+2416,9
@@
int _lttng_event_header_declare(struct lttng_session *session)
* in future versions.
* This function may return a negative offset. It may happen if the
* system sets the REALTIME clock to 0 after boot.
* in future versions.
* This function may return a negative offset. It may happen if the
* system sets the REALTIME clock to 0 after boot.
+ *
+ * Use 64bit timespec on kernels that have it, this makes 32bit arch
+ * y2038 compliant.
*/
static
int64_t measure_clock_offset(void)
*/
static
int64_t measure_clock_offset(void)
@@
-2422,13
+2426,21
@@
int64_t measure_clock_offset(void)
uint64_t monotonic_avg, monotonic[2], realtime;
uint64_t tcf = trace_clock_freq();
int64_t offset;
uint64_t monotonic_avg, monotonic[2], realtime;
uint64_t tcf = trace_clock_freq();
int64_t offset;
- struct timespec rts = { 0, 0 };
unsigned long flags;
unsigned long flags;
+#ifdef LTTNG_KERNEL_HAS_TIMESPEC64
+ struct timespec64 rts = { 0, 0 };
+#else
+ struct timespec rts = { 0, 0 };
+#endif
/* Disable interrupts to increase correlation precision. */
local_irq_save(flags);
monotonic[0] = trace_clock_read64();
/* Disable interrupts to increase correlation precision. */
local_irq_save(flags);
monotonic[0] = trace_clock_read64();
+#ifdef LTTNG_KERNEL_HAS_TIMESPEC64
+ ktime_get_real_ts64(&rts);
+#else
getnstimeofday(&rts);
getnstimeofday(&rts);
+#endif
monotonic[1] = trace_clock_read64();
local_irq_restore(flags);
monotonic[1] = trace_clock_read64();
local_irq_restore(flags);
This page took
0.025742 seconds
and
4
git commands to generate.