libust_la_SOURCES = marker.c marker.h tracepoint.c tracepoint.h immediate.h channels.c channels.h marker-control.c marker-control.h relay.c relay.h tracer.c tracer.h tracercore.c tracercore.h serialize.c tracectl.c $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/share/usterr.h localerr.h
libust_la_LDFLAGS = -no-undefined -version-info 0:0:0
libust_la_LIBADD = $(URCU_LIBS) -lpthread
+libust_la_CFLAGS = -DUST_COMPONENT="libust"
+++ /dev/null
-#include "usterr.h"
--- /dev/null
+#include "usterr.h"
#ifndef USTERR_H
#define USTERR_H
-//#define DEBUG
+#ifndef UST_COMPONENT
+//#error UST_COMPONENT is undefined
+#define UST_COMPONENT libust
+#endif
+
+/* To stringify the expansion of a define */
+#define XSTR(d) STR(d)
+#define STR(s) #s
+
+#define UST_STR_COMPONENT XSTR(UST_COMPONENT)
+
+#define DEBUG
#ifdef DEBUG
-# define DBG(fmt, args...) do { fprintf(stderr, fmt "\n", ## args); fflush(stderr); } while(0)
+# define DBG(fmt, args...) do { fprintf(stderr, UST_STR_COMPONENT ": " fmt "(" __FILE__ ":" XSTR(__LINE__) ")\n", ## args); fflush(stderr); } while(0)
#else
# define DBG(fmt, args...) do {} while(0)
#endif
-#define WARN(fmt, args...) fprintf(stderr, "libust: WARNING: " fmt "\n", ## args); fflush(stderr)
-#define ERR(fmt, args...) fprintf(stderr, "libust: ERROR: " fmt "\n", ## args); fflush(stderr)
-#define BUG(fmt, args...) fprintf(stderr, "libust: BUG: " fmt "\n", ## args); fflush(stderr)
+#define WARN(fmt, args...) fprintf(stderr, UST_STR_COMPONENT ": Warning: " fmt "\n", ## args); fflush(stderr)
+#define ERR(fmt, args...) fprintf(stderr, UST_STR_COMPONENT ": Error: " fmt "\n", ## args); fflush(stderr)
+#define BUG(fmt, args...) fprintf(stderr, UST_STR_COMPONENT ": BUG: " fmt "\n", ## args); fflush(stderr)
#define PERROR(call) perror("ust: ERROR: " call)
#define BUG_ON(condition) do { if (unlikely(condition)) ERR("condition not respected (BUG)"); } while(0)
bin_PROGRAMS = ust
ust_SOURCES = ust.c $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/libustcomm/ustcomm.h $(top_builddir)/libustcmd/ustcmd.c $(top_builddir)/libustcmd/ustcmd.h localerr.h
+ust_CFLAGS = -DUST_COMPONENT=ust
-#INCLUDES = -I$(top_builddir)/share
-#INCLUDES += -I@URCU_PATH@
INCLUDES = $(KCOMPAT_CFLAGS)
-#INCLUDES += -I$(top_builddir)/libust
INCLUDES += -I$(top_builddir)/libustcomm
INCLUDES += -I$(top_builddir)/libustcmd
-
+INCLUDES += -I$(top_builddir)/share
+++ /dev/null
-#ifndef LOCALERR_H
-#define LOCALERR_H
-
-#include <stdio.h>
-
-#define DBG(fmt, args...) fprintf(stderr, "ust: " fmt "\n", ## args); fflush(stderr)
-#define WARN(fmt, args...) fprintf(stderr, "ust: WARNING: " fmt "\n", ## args); fflush(stderr)
-#define ERR(fmt, args...) fprintf(stderr, "ust: ERROR: " fmt "\n", ## args); fflush(stderr)
-#define PERROR(a) perror(a)
-
-#endif /* LOCALERR_H */
#include "ustcomm.h"
#include "ustcmd.h"
+#include "usterr.h"
enum command {
START_TRACE,
+++ /dev/null
-#include <stdio.h>
-
-//#define DEBUG
-#ifdef DEBUG
-# define DBG(fmt, args...) fprintf(stderr, "ustd: " fmt "\n", ## args); fflush(stderr)
-#else
-# define DBG(fmt, args...) do {} while(0)
-#endif
-
-#define WARN(fmt, args...) fprintf(stderr, "ustd: WARNING: " fmt "\n", ## args); fflush(stderr)
-#define ERR(fmt, args...) fprintf(stderr, "ustd: ERROR: " fmt "\n", ## args); fflush(stderr)
-#define PERROR(a) perror(a)