#include <errno.h>
#include <urcu/list.h>
+#include <string.h>
#include <lttng/lttng.h>
#include <lttng-sessiond-comm.h>
#include <lttngerr.h>
+#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST
+#include <ust/lttng-ust-ctl.h>
+#else
+#include "lttng-ust-ctl.h"
+#endif
+
#include "channel.h"
#include "event.h"
+#include "hashtable.h"
#include "kernel-ctl.h"
/*
end:
return ret;
}
+
+/*
+ * Enable UST tracepoint event for a channel from a UST session.
+ */
+#ifdef DISABLE
+int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
+ struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
+{
+ int ret;
+ struct lttng_ust_event ltt_uevent;
+ struct object_data *obj_event;
+
+ strncpy(ltt_uevent.name, uevent->attr.name, sizeof(ltt_uevent.name));
+ ltt_uevent.name[sizeof(ltt_uevent.name) - 1] = '\0';
+ /* TODO: adjust to other instrumentation types */
+ ltt_uevent.instrumentation = LTTNG_UST_TRACEPOINT;
+
+ ret = ustctl_create_event(app->key.sock, <t_uevent,
+ uchan->obj, &obj_event);
+ if (ret < 0) {
+ DBG("Error ustctl create event %s for app pid: %d, sock: %d ret %d",
+ uevent->attr.name, app->key.pid, app->key.sock, ret);
+ goto next;
+ }
+
+ uevent->obj = obj_event;
+ uevent->handle = obj_event->handle;
+ uevent->enabled = 1;
+ ret = LTTCOMM_OK;
+end:
+ return ret;
+}
+#endif
+
+#ifdef DISABLE
+int event_ust_disable_tracepoint(struct ltt_ust_session *ustsession,
+ struct ltt_ust_channel *ustchan, char *event_name)
+{
+ int ret;
+ struct ltt_ust_event *ustevent;
+
+ ustevent = trace_ust_find_event_by_name(ustchan->events, event_name);
+ if (ustevent == NULL) {
+ ret = LTTCOMM_NO_EVENT;
+ goto end;
+ }
+ //ret = ustctl_disable(ustsession->sock, ustevent->obj);
+ if (ret < 0) {
+ ret = LTTCOMM_UST_ENABLE_FAIL;
+ goto end;
+ }
+ ustevent->enabled = 0;
+ ret = LTTCOMM_OK;
+end:
+ return ret;
+}
+#endif