Rename uuid.h wrapper to lttng-ust-uuid.h
[lttng-ust.git] / liblttng-ust / ltt-events.c
index 2613d513e6241c86c2bbcb7dcb832653ea387cbb..2b9037ef48f0d84b8ca237733f5e3438267bb48d 100644 (file)
 
 #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>
@@ -34,7 +32,7 @@
 #include <stddef.h>
 #include <inttypes.h>
 #include <time.h>
-#include <sys/prctl.h>
+#include <lttng/ust-endian.h>
 #include "clock.h"
 
 #include <urcu-bp.h>
@@ -48,6 +46,8 @@
 #include <usterr-signal-safe.h>
 #include <helper.h>
 #include "error.h"
+#include "compat.h"
+#include "lttng-ust-uuid.h"
 
 #include "tracepoint-internal.h"
 #include "ltt-tracer.h"
@@ -56,8 +56,6 @@
 #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
@@ -248,9 +246,10 @@ int pending_probe_fix_events(const struct lttng_event_desc *desc)
 
                                memcpy(&event_param, &sw->event_param,
                                                sizeof(event_param));
-                               memcpy(event_param.name,
+                               strncpy(event_param.name,
                                        desc->name,
                                        sizeof(event_param.name));
+                               event_param.name[sizeof(event_param.name) - 1] = '\0';
                                /* create event */
                                ret = ltt_event_create(sw->chan,
                                        &event_param, NULL,
@@ -309,6 +308,7 @@ void synchronize_trace(void)
 struct ltt_session *ltt_session_create(void)
 {
        struct ltt_session *session;
+       int ret;
 
        session = zmalloc(sizeof(struct ltt_session));
        if (!session)
@@ -316,7 +316,10 @@ struct ltt_session *ltt_session_create(void)
        CDS_INIT_LIST_HEAD(&session->chan);
        CDS_INIT_LIST_HEAD(&session->events);
        CDS_INIT_LIST_HEAD(&session->wildcards);
-       uuid_generate(session->uuid);
+       ret = lttng_ust_uuid_generate(session->uuid);
+       if (ret != 0) {
+               session->uuid[0] = '\0';
+       }
        cds_list_add(&session->list, &sessions);
        return session;
 }
@@ -498,7 +501,7 @@ void _ltt_channel_destroy(struct ltt_channel *chan)
  */
 int ltt_event_create(struct ltt_channel *chan,
                struct lttng_ust_event *event_param,
-               void *filter,
+               void (*filter)(struct ltt_event *event),
                struct ltt_event **_event)
 {
        const struct lttng_event_desc *desc = NULL;     /* silence gcc */
@@ -1101,11 +1104,12 @@ static
 int _ltt_session_metadata_statedump(struct ltt_session *session)
 {
        unsigned char *uuid_c = session->uuid;
-       char uuid_s[37], clock_uuid_s[CLOCK_UUID_LEN];
+       char uuid_s[LTTNG_UST_UUID_STR_LEN],
+               clock_uuid_s[LTTNG_UST_UUID_STR_LEN];
        struct ltt_channel *chan;
        struct ltt_event *event;
        int ret = 0;
-       char procname[PROCNAME_LEN] = "";
+       char procname[LTTNG_UST_PROCNAME_LEN] = "";
 
        if (!CMM_ACCESS_ONCE(session->active))
                return 0;
@@ -1159,8 +1163,8 @@ int _ltt_session_metadata_statedump(struct ltt_session *session)
                goto end;
 
        /* ignore error, just use empty string if error. */
-       (void) prctl(PR_GET_NAME, (unsigned long) procname, 0, 0, 0);
-       procname[PROCNAME_LEN - 1] = '\0';
+       lttng_ust_getprocname(procname);
+       procname[LTTNG_UST_PROCNAME_LEN - 1] = '\0';
        ret = lttng_metadata_printf(session,
                "env {\n"
                "       vpid = %d;\n"
@@ -1356,6 +1360,8 @@ struct session_wildcard *add_wildcard(struct ltt_channel *chan,
                if (!e)
                        return ERR_PTR(-ENOMEM);
                memcpy(&e->name[0], event_param->name, name_len);
+               e->loglevel_type = event_param->loglevel_type;
+               e->loglevel = event_param->loglevel;
                cds_list_add(&e->list, &wildcard_list);
                CDS_INIT_LIST_HEAD(&e->session_list);
        }
This page took 0.040783 seconds and 4 git commands to generate.