2 * Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, version 2.1 only,
6 * as published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #include <lttng/trigger/trigger-internal.h>
19 #include <lttng/condition/condition-internal.h>
20 #include <lttng/action/action-internal.h>
23 struct lttng_trigger
*lttng_trigger_create(
24 struct lttng_condition
*condition
,
25 struct lttng_action
*action
)
27 struct lttng_trigger
*trigger
= NULL
;
29 if (!condition
|| !action
) {
33 trigger
= zmalloc(sizeof(struct lttng_trigger
));
38 trigger
->condition
= condition
;
39 trigger
->action
= action
;
44 void lttng_trigger_destroy(struct lttng_trigger
*trigger
)
50 lttng_condition_destroy(trigger
->condition
);
51 lttng_action_destroy(trigger
->action
);
55 ssize_t
lttng_trigger_serialize(struct lttng_trigger
*trigger
, char *buf
)
57 ssize_t action_size
, condition_size
, ret
;
64 condition_size
= lttng_condition_serialize(trigger
->condition
, buf
);
65 if (condition_size
< 0) {
70 action_size
= lttng_action_serialize(trigger
->action
, buf
);
71 if (action_size
< 0) {
75 ret
= action_size
+ condition_size
;
This page took 0.032046 seconds and 5 git commands to generate.