uprobe: transmit binary file descritptor through lttng_payload
[lttng-tools.git] / src / common / payload.h
CommitLineData
c0a66c84
JG
1/*
2 * Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef LTTNG_PAYLOAD_H
9#define LTTNG_PAYLOAD_H
10
11#include <common/dynamic-buffer.h>
12#include <common/dynamic-array.h>
13
14/*
15 * An lttng_payload encompasses the 'data' (bytes) and any passed file
16 * descriptors as part of a message between liblttng-ctl and the session
17 * daemon.
18 */
19struct lttng_payload {
20 struct lttng_dynamic_buffer buffer;
21 /* private */
22 struct lttng_dynamic_array _fds;
23};
24
25/*
26 * Initialize a payload. This performs no allocation and is meant
de837173 27 * to be used instead of zero-ing the payload structure.
c0a66c84
JG
28 */
29LTTNG_HIDDEN
30void lttng_payload_init(struct lttng_payload *payload);
31
e368fb43
JG
32/* Copy a payload. */
33LTTNG_HIDDEN
34int lttng_payload_copy(const struct lttng_payload *src_payload,
35 struct lttng_payload *dst_payload);
36
c0a66c84
JG
37/* Release any memory used by the payload. */
38LTTNG_HIDDEN
39void lttng_payload_reset(struct lttng_payload *payload);
40
41/**
42 * Add an fd to the payload.
43 * No ownership of the file descriptor is assumed by the payload.
44 *
45 * @payload Payload instance
46 * @fd File descriptor to add to the payload
47 *
48 * Returns 0 on success, -1 on allocation error.
49 */
50LTTNG_HIDDEN
51int lttng_payload_push_fd(struct lttng_payload *payload, int fd);
52
53#endif /* LTTNG_PAYLOAD_H */
This page took 0.024392 seconds and 4 git commands to generate.