liblttng-ctl: use lttng_payload for serialize/create_from_buffer
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 10 Jun 2020 19:39:47 +0000 (15:39 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 11 Jun 2020 22:14:39 +0000 (18:14 -0400)
commitc0a66c84b5b2484b75798aec7543b680b4d4ab6c
tree55429b51c1ae5197bad57ceedd6384f58527ba6c
parent427d84693052f551da11a175d9a0f74bb6e169b3
liblttng-ctl: use lttng_payload for serialize/create_from_buffer

Some objects used in the sessiond <-> liblttng-ctl communication (e.g.
such as userspace probe event rule) contain file descriptors that
must be carried accross process boundaries (fd passing).

Since those objects are often nested within a higher-level object
hierarchy, it makes sense to adapt the existing
serialize/create_from_buffer interface to use an lttng_payload.

An lttng_payload contains a dynamic buffer and an array of file
descriptors. Objects are expected to push their file descriptors in the
payload in the same way they currently push the bytes of their binary
representation in a dynamic buffer.

Conversely, an lttng_payload_view interface is added and contains a
buffer_view and an iterator which allows objects to ̀ pop` a file
descriptors when appropriate.

Tests are added to validate the FD consumption behaviour depending
on the origin of payload views (root view or descendant view).

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id378d8b5a3376a074ab138a60733377e39a24133
36 files changed:
include/lttng/action/action-internal.h
include/lttng/action/notify-internal.h
include/lttng/action/rotate-session-internal.h
include/lttng/action/start-session-internal.h
include/lttng/action/stop-session-internal.h
include/lttng/condition/buffer-usage-internal.h
include/lttng/condition/condition-internal.h
include/lttng/condition/evaluation-internal.h
include/lttng/condition/session-consumed-size-internal.h
include/lttng/condition/session-rotation-internal.h
include/lttng/notification/notification-internal.h
include/lttng/trigger/trigger-internal.h
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/notification-thread-events.c
src/common/actions/action.c
src/common/actions/notify.c
src/common/actions/rotate-session.c
src/common/actions/start-session.c
src/common/actions/stop-session.c
src/common/buffer-usage.c
src/common/condition.c
src/common/evaluation.c
src/common/notification.c
src/common/session-consumed-size.c
src/common/session-rotation.c
src/common/sessiond-comm/Makefile.am
src/common/sessiond-comm/payload-view.c [new file with mode: 0644]
src/common/sessiond-comm/payload-view.h [new file with mode: 0644]
src/common/sessiond-comm/payload.c [new file with mode: 0644]
src/common/sessiond-comm/payload.h [new file with mode: 0644]
src/common/trigger.c
src/lib/lttng-ctl/channel.c
src/lib/lttng-ctl/lttng-ctl.c
tests/regression/tools/notification/Makefile.am
tests/unit/Makefile.am
tests/unit/test_payload.c [new file with mode: 0644]
This page took 0.029626 seconds and 5 git commands to generate.