Also add this header in common.h.
Signed-off-by: David Goulet <dgoulet@efficios.com>
#include <config.h>
#include <urcu/compiler.h>
-#include <common/lttngerr.h>
+#include <common/defaults.h>
+#include <common/common.h>
+#include <common/kernel-consumer/kernel-consumer.h>
#include <common/kernel-ctl/kernel-ctl.h>
#include <common/sessiond-comm/sessiond-comm.h>
-#include <common/kernel-consumer/kernel-consumer.h>
#include <common/ust-consumer/ust-consumer.h>
-#include <common/defaults.h>
#include "lttng-consumerd.h"
#include <string.h>
#include <unistd.h>
-#include <common/sessiond-comm/sessiond-comm.h>
-#include <common/lttngerr.h>
#include <common/common.h>
#include <common/defaults.h>
+#include <common/sessiond-comm/sessiond-comm.h>
#include "channel.h"
#include "kernel.h"
#include <unistd.h>
#include <urcu/list.h>
+#include <common/error.h>
#include <common/sessiond-comm/sessiond-comm.h>
-#include <common/lttngerr.h>
#include "context.h"
#include "kernel.h"
#include <string.h>
#include <lttng/lttng.h>
+#include <common/error.h>
#include <common/sessiond-comm/sessiond-comm.h>
-#include <common/lttngerr.h>
#include "channel.h"
#include "event.h"
#include <urcu.h>
#include <urcu/futex.h>
-#include <common/lttngerr.h>
+#include <common/error.h>
#include "futex.h"
#include <string.h>
#include <unistd.h>
-#include <common/kernel-ctl/kernel-ctl.h>
-#include <common/lttngerr.h>
#include <common/common.h>
+#include <common/kernel-ctl/kernel-ctl.h>
#include "kernel.h"
#include <config.h>
#include <bin/lttng-consumerd/lttng-consumerd.h>
-#include <common/lttngerr.h>
-#include <common/kernel-consumer/kernel-consumer.h>
-#include <common/ust-consumer/ust-consumer.h>
#include <common/common.h>
-#include <common/defaults.h>
#include <common/compat/poll.h>
+#include <common/defaults.h>
+#include <common/kernel-consumer/kernel-consumer.h>
+#include <common/ust-consumer/ust-consumer.h>
#include "lttng-sessiond.h"
#include "channel.h"
#include <sys/types.h>
#include <urcu.h>
-#include <common/sessiond-comm/sessiond-comm.h>
-#include <common/lttngerr.h>
#include <common/common.h>
+#include <common/sessiond-comm/sessiond-comm.h>
#include "session.h"
#include <unistd.h>
#include <urcu.h>
-#include <common/lttngerr.h>
+#include <common/error.h>
#include "shm.h"
#include <string.h>
#include <unistd.h>
-#include <common/lttngerr.h>
#include <common/common.h>
#include <common/defaults.h>
#include <string.h>
#include <unistd.h>
-#include <common/lttngerr.h>
#include <common/common.h>
#include <common/defaults.h>
#include <unistd.h>
#include <urcu/compiler.h>
-#include <common/lttngerr.h>
#include <common/common.h>
#include "ust-app.h"
#include <string.h>
#include <unistd.h>
-#include <common/lttngerr.h>
#include <common/common.h>
+#include <common/consumer.h>
#include <common/defaults.h>
#include <common/sessiond-comm/sessiond-comm.h>
-#include <common/consumer.h>
#include "ust-consumer.h"
#include <string.h>
#include <unistd.h>
-#include <common/lttngerr.h>
+#include <common/error.h>
#include "utils.h"
#define _LTTNG_CMD_H
#include <lttng/lttng.h>
-#include <common/lttngerr.h>
#include <common/common.h>
#include <common/defaults.h>
#include <sys/types.h>
#include <unistd.h>
-#include <common/lttngerr.h>
+#include <common/error.h>
#include "conf.h"
#include <config.h>
#include <lttng/lttng.h>
-#include <common/lttngerr.h>
+#include <common/error.h>
#include "command.h"
#include <stdlib.h>
-#include <common/lttngerr.h>
+#include <common/error.h>
#include "conf.h"
AM_CFLAGS = -fno-strict-aliasing
-noinst_HEADERS = lttngerr.h lttng-kernel.h defaults.h macros.h
+noinst_HEADERS = lttng-kernel.h defaults.h macros.h
noinst_LTLIBRARIES = libcommon.la
#ifndef _COMMON_H
#define _COMMON_H
-#include "lttngerr.h"
+#include "error.h"
#include "macros.h"
#include "runas.h"
#include <unistd.h>
#include <config.h>
-#include <common/lttngerr.h>
+#include <common/error.h>
#include <common/defaults.h>
#include "poll.h"
#include <sys/resource.h>
#include <sys/time.h>
-#include <lttngerr.h>
#include <common/defaults.h>
+#include <common/error.h>
#include "poll.h"
#include <unistd.h>
#include <common/common.h>
-#include <common/lttngerr.h>
#include <common/kernel-ctl/kernel-ctl.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/kernel-consumer/kernel-consumer.h>
--- /dev/null
+/*
+ * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; only version 2 of the License.
+ *
+ * This program 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 General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _ERROR_H
+#define _ERROR_H
+
+#include <errno.h>
+#include <stdio.h>
+
+/* Stringify the expansion of a define */
+#define XSTR(d) STR(d)
+#define STR(s) #s
+
+extern int opt_quiet;
+extern int opt_verbose;
+
+#define PRINT_ERR 0x1
+#define PRINT_WARN 0x2
+#define PRINT_BUG 0x3
+#define PRINT_MSG 0x4
+#define PRINT_DBG 0x10
+#define PRINT_DBG2 0x20
+#define PRINT_DBG3 0x30
+
+/*
+ * Macro for printing message depending on command line option and verbosity.
+ */
+#define __lttng_print(type, fmt, args...) \
+ do { \
+ if (opt_quiet == 0) { \
+ if (type == PRINT_MSG) { \
+ fprintf(stdout, fmt, ## args); \
+ } else if (((type & PRINT_DBG) && opt_verbose == 1) || \
+ ((type & (PRINT_DBG | PRINT_DBG2)) && \
+ opt_verbose == 2) || \
+ ((type & (PRINT_DBG | PRINT_DBG2 | PRINT_DBG3)) && \
+ opt_verbose == 3)) { \
+ fprintf(stderr, fmt, ## args); \
+ } else if (type & (PRINT_ERR | PRINT_WARN | PRINT_BUG)) { \
+ fprintf(stderr, fmt, ## args); \
+ } \
+ } \
+ } while (0);
+
+#define MSG(fmt, args...) \
+ __lttng_print(PRINT_MSG, fmt "\n", ## args)
+#define ERR(fmt, args...) \
+ __lttng_print(PRINT_ERR, "Error: " fmt "\n", ## args)
+#define WARN(fmt, args...) \
+ __lttng_print(PRINT_WARN, "Warning: " fmt "\n", ## args)
+#define BUG(fmt, args...) \
+ __lttng_print(PRINT_BUG, "BUG: " fmt "\n", ## args)
+
+/* Three level of debug. Use -v, -vv or -vvv for the levels */
+#define DBG(fmt, args...) __lttng_print(PRINT_DBG, "DEBUG1: " fmt \
+ " [in %s() at " __FILE__ ":" XSTR(__LINE__) "]\n", ## args, __func__)
+#define DBG2(fmt, args...) __lttng_print(PRINT_DBG2, "DEBUG2: " fmt \
+ " [in %s() at " __FILE__ ":" XSTR(__LINE__) "]\n", ## args, __func__)
+#define DBG3(fmt, args...) __lttng_print(PRINT_DBG3, "DEBUG3: " fmt \
+ " [in %s() at " __FILE__ ":" XSTR(__LINE__) "]\n", ## args, __func__)
+
+#define _PERROR(fmt, args...) \
+ __lttng_print(PRINT_ERR, "perror " fmt "\n", ## args)
+
+#define PERROR(call, args...) \
+ do { \
+ char *buf; \
+ char tmp[200]; \
+ buf = strerror_r(errno, tmp, sizeof(tmp)); \
+ _PERROR(call ": %s", ## args, buf); \
+ } while(0);
+
+#endif /* _ERROR_H */
+++ /dev/null
-/*
- * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; only version 2
- * of the License.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef _LTTNGERR_H
-#define _LTTNGERR_H
-
-#include <errno.h>
-#include <stdio.h>
-
-/* Stringify the expansion of a define */
-#define XSTR(d) STR(d)
-#define STR(s) #s
-
-extern int opt_quiet;
-extern int opt_verbose;
-
-#define PRINT_ERR 0x1
-#define PRINT_WARN 0x2
-#define PRINT_BUG 0x3
-#define PRINT_MSG 0x4
-#define PRINT_DBG 0x10
-#define PRINT_DBG2 0x20
-#define PRINT_DBG3 0x30
-
-/*
- * Macro for printing message depending on command line option and verbosity.
- */
-#define __lttng_print(type, fmt, args...) \
- do { \
- if (opt_quiet == 0) { \
- if (type == PRINT_MSG) { \
- fprintf(stdout, fmt, ## args); \
- } else if (((type & PRINT_DBG) && opt_verbose == 1) || \
- ((type & (PRINT_DBG | PRINT_DBG2)) && \
- opt_verbose == 2) || \
- ((type & (PRINT_DBG | PRINT_DBG2 | PRINT_DBG3)) && \
- opt_verbose == 3)) { \
- fprintf(stderr, fmt, ## args); \
- } else if (type & (PRINT_ERR | PRINT_WARN | PRINT_BUG)) { \
- fprintf(stderr, fmt, ## args); \
- } \
- } \
- } while (0);
-
-#define MSG(fmt, args...) \
- __lttng_print(PRINT_MSG, fmt "\n", ## args)
-#define ERR(fmt, args...) \
- __lttng_print(PRINT_ERR, "Error: " fmt "\n", ## args)
-#define WARN(fmt, args...) \
- __lttng_print(PRINT_WARN, "Warning: " fmt "\n", ## args)
-#define BUG(fmt, args...) \
- __lttng_print(PRINT_BUG, "BUG: " fmt "\n", ## args)
-
-/* Three level of debug. Use -v, -vv or -vvv for the levels */
-#define DBG(fmt, args...) __lttng_print(PRINT_DBG, "DEBUG1: " fmt \
- " [in %s() at " __FILE__ ":" XSTR(__LINE__) "]\n", ## args, __func__)
-#define DBG2(fmt, args...) __lttng_print(PRINT_DBG2, "DEBUG2: " fmt \
- " [in %s() at " __FILE__ ":" XSTR(__LINE__) "]\n", ## args, __func__)
-#define DBG3(fmt, args...) __lttng_print(PRINT_DBG3, "DEBUG3: " fmt \
- " [in %s() at " __FILE__ ":" XSTR(__LINE__) "]\n", ## args, __func__)
-
-#define _PERROR(fmt, args...) \
- __lttng_print(PRINT_ERR, "perror " fmt "\n", ## args)
-
-#define PERROR(call, args...) \
- do { \
- char *buf; \
- char tmp[200]; \
- buf = strerror_r(errno, tmp, sizeof(tmp)); \
- _PERROR(call ": %s", ## args, buf); \
- } while(0);
-
-#endif /* _LTTNGERR_H */
#include <sched.h>
#include <sys/mman.h>
-#include <common/lttngerr.h>
+#include <common/error.h>
#include "runas.h"
#include <string.h>
#include <unistd.h>
-#include <common/sessiond-comm/sessiond-comm.h>
-#include <common/lttngerr.h>
#include <common/common.h>
#include <common/defaults.h>
+#include <common/sessiond-comm/sessiond-comm.h>
#include <lttng/lttng.h>
/* Socket to session daemon for communication */