lttng: list valid condition / action names if missing or unknown
[lttng-tools.git] / src / common / event.cpp
1 /*
2 * Copyright (C) 2018 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #include <lttng/event-internal.h>
9 #include <common/error.h>
10
11 struct lttng_event *lttng_event_copy(const struct lttng_event *event)
12 {
13 struct lttng_event *new_event;
14 struct lttng_event_extended *new_event_extended;
15
16 new_event = (lttng_event *) zmalloc(sizeof(*event));
17 if (!new_event) {
18 PERROR("Error allocating event structure");
19 goto end;
20 }
21
22 /* Copy the content of the old event. */
23 memcpy(new_event, event, sizeof(*event));
24
25 /*
26 * We need to create a new extended since the previous pointer is now
27 * invalid.
28 */
29 new_event_extended = (lttng_event_extended *) zmalloc(sizeof(*new_event_extended));
30 if (!new_event_extended) {
31 PERROR("Error allocating event extended structure");
32 goto error;
33 }
34
35 new_event->extended.ptr = new_event_extended;
36 end:
37 return new_event;
38 error:
39 free(new_event);
40 new_event = NULL;
41 goto end;
42 }
This page took 0.033108 seconds and 4 git commands to generate.