2 * Copyright (C) 2019 - Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
8 * This program 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 General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include <common/defaults.h>
25 #include <common/error.h>
26 #include <common/utils.h>
34 int cmd_clear_session(struct ltt_session
*session
)
38 if (!session
->has_been_started
) {
39 /* Nothing to be cleared, do not warn */
45 * Unsupported feature in lttng-relayd before 2.12.
47 if (session
->consumer
->type
== CONSUMER_DST_NET
&&
48 (session
->consumer
->relay_major_version
== 2 &&
49 session
->consumer
->relay_minor_version
< 12)) {
50 ret
= LTTNG_ERR_CLEAR_NOT_AVAILABLE_RELAY
;
54 /* TODO: Should we check for disallowed here or consumer side? */
56 /* Snapshot session are the only one supported for now */
57 if (!session
->snapshot_mode
) {
59 * TODO: this error code is temporary and will be removed since
60 * we will be supporting all session type
62 ret
= LTTNG_ERR_CLEAR_NOT_AVAILABLE
;
66 if (session
->kernel_session
) {
67 ret
= kernel_clear_session(session
);
68 if (ret
!= LTTNG_OK
) {
72 if (session
->ust_session
) {
73 ret
= ust_app_clear_session(session
);
74 if (ret
!= LTTNG_OK
) {