Fix: don't perform unaligned integer read/writes

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add limits compatibility header

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Use BABELTRACE_HOST_NAME_MAX in test_ctf_writer.c

This fixes the build on FreeBSD.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: Return from main instead of calling exit()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Replace usages of limits.h with the compatibility header

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix Python: Add a comment warning about an API limitation

Add a comment warning about a possible misuse of the events()
API. The objects returned by this function shall not be copied
as they become invalid as soon as the next event is accessed.

It is also invalid to access an event after its generator has
gone out of scope.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: align objstack on 8 bytes

Architectures such as sparc32 have 32-bit pointers, but require
alignment on 8 bytes multiples for 64-bit integers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: Don't assume that PROT_WRITE grants read permissions

The prot flag passed to mmap() is set to PROT_WRITE when the O_RDWR
access flags is used. This assumes that PROT_WRITE grants read
permissions on the mmap'ed region. While this is true on x86, this
causes a segmentation fault on SPARC and, presumably, other
architectures implementing strict access permissions.

CTF Writer needs read permissions since the unaligned integer writes
may use load instructions as the value is read back to perform the
required shifting/masking is performed in the _bt_bitfield_write_*
macros.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: incorrect compiler warning

The compiler does not see that *target will necessarily set the values.
Initialize the variables to 0 to silence uninitialized variable warning.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: offset_s and CTF clocks with frequency != 1GHz

Take into account offset_s from the clock description when calculating
the tc_offset in ctf_get_real_timestamp().

Do not assume that the single_clock->offset field is at a frequency of
1GHz. Take into account the its clock frequency.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: scan-build warnings in CTF Writer/IR tests

scan-build reported that strcmp could be called on a NULL string
when some tests fail.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add UUID accessors to CTF-IR clock

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: Add tests for new clock UUID accessors

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: cleanup extra whitespace

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: check for < 0 rather than -1 specifically

Change test conditions for functions whose documentation
states that "a negative value" is returned on error.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Python bindings: add "datetime" property to the Event class

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Python bindings: cleanup whitespace

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Clean-up: remove extra whitespace in ctf-ir/clock.h

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Python bindings: Add UUID accessors to the Clock class

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Documentation fix: add expected types to packet context accessors

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>