Add get proc name wrapper for FreeBSD
[lttng-ust.git] / liblttng-ust / ltt-events.c
index 775e73cad828f5119a8b3275b4f86470d55d07b9..5a624c492c4b3a4fae98c13857ae00be06bbb17b 100644 (file)
@@ -33,7 +33,6 @@
 #include <stddef.h>
 #include <inttypes.h>
 #include <time.h>
-#include <sys/prctl.h>
 #include <lttng/ust-endian.h>
 #include "clock.h"
 
@@ -48,6 +47,7 @@
 #include <usterr-signal-safe.h>
 #include <helper.h>
 #include "error.h"
+#include "compat.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
@@ -1106,7 +1104,7 @@ int _ltt_session_metadata_statedump(struct ltt_session *session)
        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;
@@ -1160,8 +1158,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"
This page took 0.023554 seconds and 4 git commands to generate.