/*
- * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
- * Copyright (C) 2016 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2 only,
- * as published by the Free Software Foundation.
+ * SPDX-License-Identifier: GPL-2.0-only
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define _LGPL_SOURCE
-#include <errno.h>
#include <urcu/list.h>
#include <string.h>
+#include <common/compat/errno.h>
#include <lttng/lttng.h>
#include <common/error.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include "event.h"
#include "kernel.h"
#include "lttng-sessiond.h"
-#include "ust-ctl.h"
+#include "lttng-ust-ctl.h"
+#include "lttng-ust-error.h"
#include "ust-app.h"
#include "trace-kernel.h"
#include "trace-ust.h"
* If event_name is NULL all events of the specified type are disabled.
*/
int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
- char *event_name, enum lttng_event_type type)
+ const char *event_name, enum lttng_event_type type)
{
int ret, error = 0, found = 0;
struct ltt_kernel_event *kevent;
rcu_read_lock();
uevent = trace_ust_find_event(uchan->events, event->name, filter,
- event->loglevel_type, event->loglevel, exclusion);
+ (enum lttng_ust_loglevel_type) event->loglevel_type,
+ event->loglevel, exclusion);
if (!uevent) {
ret = trace_ust_create_event(event, filter_expression,
filter, exclusion, internal_event, &uevent);
if (uevent->enabled) {
/* It's already enabled so everything is OK */
+ assert(!to_create);
ret = LTTNG_ERR_UST_EVENT_ENABLED;
goto end;
}
* Disable UST tracepoint of a channel from a UST session.
*/
int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan, char *event_name)
+ struct ltt_ust_channel *uchan, const char *event_name)
{
int ret;
struct ltt_ust_event *uevent;
filter = NULL;
filter_expression = NULL;
created = 1;
+ assert(!aevent->enabled);
}
- if (created && filter) {
- ret = add_filter_app_ctx(filter, filter_expression, agt);
+ if (created && aevent->filter) {
+ ret = add_filter_app_ctx(
+ aevent->filter, aevent->filter_expression, agt);
if (ret != LTTNG_OK) {
goto error;
}
* Return LTTNG_OK on success or else a LTTNG_ERR* code.
*/
int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt,
- char *event_name)
+ const char *event_name)
{
int ret = LTTNG_OK;
struct agent_event *aevent;