/*
* ltt-events.c
*
- * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
* Holds LTTng per-session event registry.
*
- * Dual LGPL v2.1/GPL v2 license.
+ * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; only
+ * version 2.1 of the License.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _GNU_SOURCE
#include <stdio.h>
+#include <endian.h>
#include <urcu/list.h>
#include <urcu/hlist.h>
#include <pthread.h>
+#include <uuid/uuid.h>
#include <errno.h>
#include <sys/shm.h>
#include <sys/ipc.h>
#include <stddef.h>
#include <inttypes.h>
#include <time.h>
-#include <lttng/ust-endian.h>
+#include <sys/prctl.h>
#include "clock.h"
#include <urcu-bp.h>
#include <usterr-signal-safe.h>
#include <helper.h>
#include "error.h"
-#include "compat.h"
-#include "uuid.h"
#include "tracepoint-internal.h"
#include "ltt-tracer.h"
#include "../libringbuffer/shm.h"
#include "jhash.h"
+#define PROCNAME_LEN 17
+
/*
* The sessions mutex is the centralized mutex across UST tracing
* control and probe registration. All operations within this file are
remove_pending_probe(e);
ret |= __tracepoint_probe_register(name,
event->desc->probe_callback,
- event);
+ event, event->desc->signature);
if (ret)
continue;
event->id = chan->free_event_id++;
struct ltt_session *ltt_session_create(void)
{
struct ltt_session *session;
- int ret;
session = zmalloc(sizeof(struct ltt_session));
if (!session)
CDS_INIT_LIST_HEAD(&session->chan);
CDS_INIT_LIST_HEAD(&session->events);
CDS_INIT_LIST_HEAD(&session->wildcards);
- ret = lttng_ust_uuid_generate(session->uuid);
- if (ret != 0) {
- session->uuid[0] = '\0';
- }
+ uuid_generate(session->uuid);
cds_list_add(&session->list, &sessions);
return session;
}
* headers. Therefore the "chan" information used as input
* should be already accessible.
*/
- chan = transport->ops.channel_create("[lttng]", buf_addr,
+ chan = transport->ops.channel_create(transport_name, buf_addr,
subbuf_size, num_subbuf, switch_timer_interval,
read_timer_interval, shm_fd, wait_fd,
memory_map_size, chan_priv_init);
struct ltt_event *event;
int ret = 0;
- if (chan->used_event_id == -1UL) {
+ if (chan->used_event_id == -1U) {
ret = -ENOMEM;
goto full;
}
if (event->desc) {
ret = __tracepoint_probe_register(event_param->name,
event->desc->probe_callback,
- event);
+ event, event->desc->signature);
if (ret)
goto register_error;
event->id = chan->free_event_id++;
int _ltt_session_metadata_statedump(struct ltt_session *session)
{
unsigned char *uuid_c = session->uuid;
- char uuid_s[LTTNG_UST_UUID_STR_LEN],
- clock_uuid_s[LTTNG_UST_UUID_STR_LEN];
+ char uuid_s[37], clock_uuid_s[CLOCK_UUID_LEN];
struct ltt_channel *chan;
struct ltt_event *event;
int ret = 0;
- char procname[LTTNG_UST_PROCNAME_LEN] = "";
+ char procname[PROCNAME_LEN] = "";
if (!CMM_ACCESS_ONCE(session->active))
return 0;
goto end;
/* ignore error, just use empty string if error. */
- lttng_ust_getprocname(procname);
- procname[LTTNG_UST_PROCNAME_LEN - 1] = '\0';
+ (void) prctl(PR_GET_NAME, (unsigned long) procname, 0, 0, 0);
+ procname[PROCNAME_LEN - 1] = '\0';
ret = lttng_metadata_printf(session,
"env {\n"
" vpid = %d;\n"
wildcard->enabled = 0;
return 0;
}
+
+/*
+ * Take the TLS "fault" in libuuid if dlopen'd, which can take the
+ * dynamic linker mutex, outside of the UST lock, since the UST lock is
+ * taken in constructors, which are called with dynamic linker mutex
+ * held.
+ */
+void lttng_fixup_event_tls(void)
+{
+ unsigned char uuid[37];
+
+ (void) uuid_generate(uuid);
+}