lttng-ctl: add event field value API
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 1 May 2020 20:31:01 +0000 (16:31 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 11 Mar 2021 20:31:53 +0000 (15:31 -0500)
commitd28fcdec589e6f0c98fed2f6c094defec58e2b24
treec814feed5027c163b23408c5965a7d1c9c8eb4c2
parent1136f41bfcb45da596fcb147b38b3181223f87e1
lttng-ctl: add event field value API

This patch adds a new read-only event field value API to liblttng-ctl.
It also adds the internal functions to create such objects.

As of this patch, an event field value is one of:

* An unsigned integer (64-bit).
* A signed integer (64-bit).
* An unsigned enumeration (64-bit).
* A signed enumeration (64-bit).
* A real number (double precision).
* A string (UTF-8).
* An array of zero or more event field values.

The first purpose of this API will be to access the captured field
values of a notification's trigger condition evaluation.

An enumeration event field value conceptually is an integer event field
value, therefore lttng_event_field_value_unsigned_int_get_value() works
for an unsigned enumeration and
lttng_event_field_value_signed_int_get_value() works for a signed
enumeration.

The compound event field values (array only, as of this patch) can
return the `LTTNG_EVENT_FIELD_VALUE_STATUS_UNAVAILABLE` status when you
access a contained event field value. This indicates that there is no
field at this location. For the captured field value use case, it means
the event did not have any field at that position considering the
condition's capture descriptors. Internally, call
lttng_event_field_value_array_append_unavailable() to append an
unavailable event field value to an array field value.

The lttng_event_field_value_array_get_element_at_index() function can
also return an event field value of which the type, as returned by
lttng_event_field_value_get_type(), is
`LTTNG_EVENT_FIELD_VALUE_TYPE_UNKNOWN`. This is different from the
`LTTNG_EVENT_FIELD_VALUE_STATUS_UNAVAILABLE` status: the event field
value exists (which is why there's a valid
`struct lttng_event_field_value *`), but its type is unknown by this
version of the library. This makes it possible to add new event field
value types in the future while remaining forward compatible.

Note that enumeration labels will not visible to clients since the
kernel tracer does not make their content accessible to the session
daemon.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I04d327d9f50ff6c6e2ad1f5a1e56c3af25c92c15
Depends-on: lttng-ust: I5a800fc92e588c2a6a0e26282b0ad5f31c044479
include/Makefile.am
include/lttng/event-field-value-internal.h [new file with mode: 0644]
include/lttng/event-field-value.h [new file with mode: 0644]
include/lttng/lttng.h
src/common/Makefile.am
src/common/event-field-value.c [new file with mode: 0644]
This page took 0.025696 seconds and 4 git commands to generate.