Skip to contentSkip to conversation

Backported to glibc 2.8

PATCH Superseded Jesper Derehag 3 participants 7 messages Apr 23, 2014 – Apr 30, 2014 5 messages not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH v3 1/1 Backported to glibc 2.8

In reply to a message not in the archive

This patch enables lttng-tools to run on top of glibc 2.8. Overall it fixes 2 things:
1. No support for epoll_create1(..) and EPOLL_CLOEXEC.
2. No support for htobe/betoh

For 1, we revert back to epoll_create() and then sets CLOEXEC through fcntl instead.
For 2, we define htobe/betoh as part of the compat/endian.h and make sure that any users of those functions actually include compat/endian.h instead of implicit include of system endian.h

---
Compared to v2 this fixes the coding style for comments. I just want to mention that I did run checkpatch for v2 and that it passed. But fixed according to Mr. Desnoyers comments anyway.

 src/bin/lttng-relayd/cmd-2-2.c               |  2 +
 src/bin/lttng-relayd/cmd-2-4.c               |  2 +
 src/bin/lttng-relayd/live.c                  |  1 +
 src/bin/lttng-relayd/main.c                  |  1 +
 src/bin/lttng-sessiond/jul-thread.c          |  2 +
 src/bin/lttng-sessiond/jul.c                 |  2 +
 src/common/compat/compat-epoll.c             |  2 +-
 src/common/compat/endian.h                   | 94 +++++++++++++++++++++++++++-
 src/common/compat/poll.h                     | 29 +++++++++
 src/common/consumer-timer.c                  |  1 +
 src/common/consumer.c                        |  1 +
 src/common/index/index.c                     |  1 +
 src/common/kernel-consumer/kernel-consumer.c |  1 +
 src/common/relayd/relayd.c                   |  1 +
 src/common/ust-consumer/ust-consumer.c       |  1 +
 tests/regression/tools/live/live_test.c      |  2 +
 16 files changed, 141 insertions(+), 2 deletions(-)
src/bin/lttng-relayd/cmd-2-2.c +2 -0
index b7299a5..978a11e 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "cmd-2-1.h"
 #include "utils.h"
src/bin/lttng-relayd/cmd-2-4.c +2 -0
index 3196383..6d927a0 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "lttng-relayd.h"
 
src/bin/lttng-relayd/live.c +1 -0
index c60f7e4..d8517d2 100644
@@ -43,6 +43,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/futex.h>
 #include <common/index/index.h>
src/bin/lttng-relayd/main.c +1 -0
index a93151a..93b08fc 100644
@@ -44,6 +44,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/daemonize.h>
 #include <common/futex.h>
src/bin/lttng-sessiond/jul-thread.c +2 -0
index cc694df..9859a10 100644
@@ -23,6 +23,8 @@
 #include <common/uri.h>
 #include <common/utils.h>
 
+#include <common/compat/endian.h>
+
 #include "fd-limit.h"
 #include "jul-thread.h"
 #include "lttng-sessiond.h"
src/bin/lttng-sessiond/jul.c +2 -0
index 7bb0d75..da4cf67 100644
@@ -22,6 +22,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/jul.h>
 
+#include <common/compat/endian.h>
+
 #include "jul.h"
 #include "ust-app.h"
 #include "utils.h"
src/common/compat/compat-epoll.c +1 -1
index ecd09a0..368fae1 100644
@@ -81,7 +81,7 @@ int compat_epoll_create(struct lttng_poll_event *events, int size, int flags)
 		size = poll_max_size;
 	}
 
-	ret = epoll_create1(flags);
+	ret = compat_glibc_epoll_create(size, flags);
 	if (ret < 0) {
 		/* At this point, every error is fatal */
 		PERROR("epoll_create1");
src/common/compat/endian.h +93 -1

104 lines not on this page · raw message

src/common/compat/poll.h +29 -0
index b019b42..90fe813 100644
@@ -52,6 +52,8 @@ static inline void __lttng_poll_free(void *events)
 #ifdef HAVE_EPOLL
 #include <sys/epoll.h>
 #include <stdio.h>
+#include <features.h>
+#include <common/compat/fcntl.h>
 
 /* See man epoll(7) for this define path */
 #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches"
@@ -71,7 +73,15 @@ enum {
 	LPOLLNVAL = EPOLLHUP,
 	LPOLLRDHUP = EPOLLRDHUP,
 	/* Close on exec feature of epoll */
+#if __GLIBC_PREREQ(2, 9)
 	LTTNG_CLOEXEC = EPOLL_CLOEXEC,
+#else
+	/* EPOLL_CLOEXEC was added in glibc 2.8 (usually used in conjunction
+	 * with epoll_create1(..)), but since neither EPOLL_CLOEXEC exists nor
+	 * epoll_create1(..), we set it to FD_CLOEXEC so that we can pass it
+	 * directly to fcntl(..) instead */
+	LTTNG_CLOEXEC = FD_CLOEXEC,
+#endif
 };
 
 struct compat_epoll_event {
@@ -115,6 +125,25 @@ extern int compat_epoll_create(struct lttng_poll_event *events,
 #define lttng_poll_create(events, size, flags) \
 	compat_epoll_create(events, size, flags)
 
+#if __GLIBC_PREREQ(2, 9)
+static inline int compat_glibc_epoll_create(int size __attribute__((unused)),
+		int flags)
+{
+	return epoll_create1(flags);
+}
+#else
+static inline int compat_glibc_epoll_create(int size, int flags)
+{
+	/* epoll_create1 was added in glibc 2.9, but unfortunatly reverting to
+	 * epoll_create(..) also means that we loose the possibility to
+	 * directly set the EPOLL_CLOEXEC, so try and do it anyway but through
+	 * fcntl(..). */
+	int efd = epoll_create(size);
+	assert(fcntl(efd, F_SETFD, flags) != -1);
+	return efd;
+}
+#endif
+
 /*
  * Wait on epoll set with the number of fd registered to the lttng_poll_event
  * data structure (events).
src/common/consumer-timer.c +1 -0
index dc6f2f7..c659bf6 100644
@@ -23,6 +23,7 @@
 
 #include <bin/lttng-consumerd/health-consumerd.h>
 #include <common/common.h>
+#include <common/compat/endian.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/kernel-consumer/kernel-consumer.h>
 #include <common/consumer-stream.h>
src/common/consumer.c +1 -0
index e80ac6b..cba4a60 100644
@@ -34,6 +34,7 @@
 #include <common/common.h>
 #include <common/utils.h>
 #include <common/compat/poll.h>
+#include <common/compat/endian.h>
 #include <common/index/index.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/sessiond-comm/relayd.h>
src/common/index/index.c +1 -0
index abc0985..a462a63 100644
@@ -24,6 +24,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/utils.h>
 
 #include "index.h"
src/common/kernel-consumer/kernel-consumer.c +1 -0
index d15329f..57dc2ba 100644
@@ -35,6 +35,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/pipe.h>
 #include <common/relayd/relayd.h>
 #include <common/utils.h>
src/common/relayd/relayd.c +1 -0
index 3de19c2..38ebdbd 100644
@@ -25,6 +25,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/index/ctf-index.h>
 
src/common/ust-consumer/ust-consumer.c +1 -0
index 9f2e739..b8c1a3c 100644
@@ -37,6 +37,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/relayd/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/consumer-metadata-cache.h>
 #include <common/consumer-stream.h>
 #include <common/consumer-timer.h>
tests/regression/tools/live/live_test.c +2 -0
index aff8977..d2c9050 100644
@@ -43,6 +43,8 @@
 #include <bin/lttng-relayd/lttng-viewer-abi.h>
 #include <common/index/ctf-index.h>
 
+#include <common/compat/endian.h>
+
 #define SESSION1 "test1"
 #define RELAYD_URL "net://localhost"
 #define LIVE_TIMER 2000000
Signature · 1 line
1.8.4.1
#3 lore raw
In reply to a message not in the archive

----- Original Message -----

Quoted 149 lines

From: "Jesper Derehag" <[email protected]>
To: "mathieu desnoyers" <[email protected]>
Cc: [email protected], [email protected], "Jesper Derehag" <[email protected]>
Sent: Wednesday, April 23, 2014 5:42:30 PM
Subject: [PATCH v3 lttng-tools] Backported to glibc 2.8

This patch enables lttng-tools to run on top of glibc 2.8. Overall it fixes 2 things:
1. No support for epoll_create1(..) and EPOLL_CLOEXEC.
2. No support for htobe/betoh

For 1, we revert back to epoll_create() and then sets CLOEXEC through fcntl instead.
For 2, we define htobe/betoh as part of the compat/endian.h and make sure that any users of those functions actually include compat/endian.h instead of implicit include of system endian.h

---
Compared to v2 this fixes the coding style for comments. I just want to mention that I did run checkpatch for v2 and that it passed. But fixed according to Mr. Desnoyers comments anyway.

 src/bin/lttng-relayd/cmd-2-2.c               |  2 +
 src/bin/lttng-relayd/cmd-2-4.c               |  2 +
 src/bin/lttng-relayd/live.c                  |  1 +
 src/bin/lttng-relayd/main.c                  |  1 +
 src/bin/lttng-sessiond/jul-thread.c          |  2 +
 src/bin/lttng-sessiond/jul.c                 |  2 +
 src/common/compat/compat-epoll.c             |  2 +-
 src/common/compat/endian.h                   | 94
 +++++++++++++++++++++++++++-
 src/common/compat/poll.h                     | 29 +++++++++
 src/common/consumer-timer.c                  |  1 +
 src/common/consumer.c                        |  1 +
 src/common/index/index.c                     |  1 +
 src/common/kernel-consumer/kernel-consumer.c |  1 +
 src/common/relayd/relayd.c                   |  1 +
 src/common/ust-consumer/ust-consumer.c       |  1 +
 tests/regression/tools/live/live_test.c      |  2 +
 16 files changed, 141 insertions(+), 2 deletions(-)
src/bin/lttng-relayd/cmd-2-2.c +2 -0
index b7299a5..978a11e 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "cmd-2-1.h"
 #include "utils.h"
src/bin/lttng-relayd/cmd-2-4.c +2 -0
index 3196383..6d927a0 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "lttng-relayd.h"
 
src/bin/lttng-relayd/live.c +1 -0
index c60f7e4..d8517d2 100644
@@ -43,6 +43,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/futex.h>
 #include <common/index/index.h>
src/bin/lttng-relayd/main.c +1 -0
index a93151a..93b08fc 100644
@@ -44,6 +44,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/daemonize.h>
 #include <common/futex.h>
src/bin/lttng-sessiond/jul-thread.c +2 -0
index cc694df..9859a10 100644
@@ -23,6 +23,8 @@
 #include <common/uri.h>
 #include <common/utils.h>
 
+#include <common/compat/endian.h>
+
 #include "fd-limit.h"
 #include "jul-thread.h"
 #include "lttng-sessiond.h"
src/bin/lttng-sessiond/jul.c +2 -0
index 7bb0d75..da4cf67 100644
@@ -22,6 +22,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/jul.h>
 
+#include <common/compat/endian.h>
+
 #include "jul.h"
 #include "ust-app.h"
 #include "utils.h"
src/common/compat/compat-epoll.c +1 -1
index ecd09a0..368fae1 100644
@@ -81,7 +81,7 @@ int compat_epoll_create(struct lttng_poll_event *events,
 int size, int flags)
 		size = poll_max_size;
 	}
 
-	ret = epoll_create1(flags);
+	ret = compat_glibc_epoll_create(size, flags);
 	if (ret < 0) {
 		/* At this point, every error is fatal */
src/common/compat/compat-epoll.c +0 -0
 		PERROR("epoll_create1");
src/common/compat/endian.h +1 -1
index 2850866..7ffba9d 100644
@@ -15,11 +15,103 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifdef _COMPAT_ENDIAN_H
+#ifndef _COMPAT_ENDIAN_H
 #define _COMPAT_ENDIAN_H

src/common/compat/endian.h line 29

Quoted 10 lines
src/common/compat/endian.h +7 -0
 
 #ifdef __linux__
 #include <endian.h>
+
+/*
+ * htobe/betoh are not defined for glibc <2.9, so add them
+ * explicitly if they are missing.
+ */
+#ifdef __USE_BSD
+/* Conversion interfaces.*/

I hate to have to say this, but you might want to add exactly one space between the "." and the "*" above.

Quoted 123 lines
src/common/compat/endian.h +85 -0
+# include <byteswap.h>
+
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  ifndef htobe16
+#   define htobe16(x) __bswap_16(x)
+#  endif
+#  ifndef htole16
+#   define htole16(x) (x)
+#  endif
+#  ifndef be16toh
+#   define be16toh(x) __bswap_16(x)
+#  endif
+#  ifndef le16toh
+#   define le16toh(x) (x)
+#  endif
+
+#  ifndef htobe32
+#   define htobe32(x) __bswap_32(x)
+#  endif
+#  ifndef htole32
+#   define htole32(x) (x)
+#  endif
+#  ifndef be32toh
+#   define be32toh(x) __bswap_32(x)
+#  endif
+#  ifndef le32toh
+#   define le32toh(x) (x)
+#  endif
+
+#  ifndef htobe64
+#   define htobe64(x) __bswap_64(x)
+#  endif
+#  ifndef htole64
+#   define htole64(x) (x)
+#  endif
+#  ifndef be64toh
+#   define be64toh(x) __bswap_64(x)
+#  endif
+#  ifndef le64toh
+#   define le64toh(x) (x)
+#  endif
+
+# else /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#  ifndef htobe16
+#   define htobe16(x) (x)
+#  endif
+#  ifndef htole16
+#   define htole16(x) __bswap_16(x)
+#  endif
+#  ifndef be16toh
+#   define be16toh(x) (x)
+#  endif
+#  ifndef le16toh
+#   define le16toh(x) __bswap_16(x)
+#  endif
+
+#  ifndef htobe32
+#   define htobe32(x) (x)
+#  endif
+#  ifndef htole32
+#   define htole32(x) __bswap_32(x)
+#  endif
+#  ifndef be32toh
+#   define be32toh(x) (x)
+#  endif
+#  ifndef le32toh
+#   define le32toh(x) __bswap_32(x)
+#  endif
+
+#  ifndef htobe64
+#   define htobe64(x) (x)
+#  endif
+#  ifndef htole64
+#   define htole64(x) __bswap_64(x)
+#  endif
+#  ifndef be64toh
+#   define be64toh(x) (x)
+#  endif
+#  ifndef le64toh
+#   define le64toh(x) __bswap_64(x)
+#  endif
+
+# endif /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#endif /* __USE_BSD */
+
 #elif defined(__FreeBSD__)
 #include <machine/endian.h>
 #else
src/common/compat/poll.h +11 -0
index b019b42..90fe813 100644
@@ -52,6 +52,8 @@ static inline void __lttng_poll_free(void *events)
 #ifdef HAVE_EPOLL
 #include <sys/epoll.h>
 #include <stdio.h>
+#include <features.h>
+#include <common/compat/fcntl.h>
 
 /* See man epoll(7) for this define path */
 #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches"
@@ -71,7 +73,15 @@ enum {
 	LPOLLNVAL = EPOLLHUP,
 	LPOLLRDHUP = EPOLLRDHUP,
 	/* Close on exec feature of epoll */
+#if __GLIBC_PREREQ(2, 9)
 	LTTNG_CLOEXEC = EPOLL_CLOEXEC,
+#else
+	/* EPOLL_CLOEXEC was added in glibc 2.8 (usually used in conjunction
+	 * with epoll_create1(..)), but since neither EPOLL_CLOEXEC exists nor
+	 * epoll_create1(..), we set it to FD_CLOEXEC so that we can pass it
+	 * directly to fcntl(..) instead */
+	LTTNG_CLOEXEC = FD_CLOEXEC,
+#endif
 };
 
 struct compat_epoll_event {
@@ -115,6 +125,25 @@ extern int compat_epoll_create(struct lttng_poll_event
 *events,
 #define lttng_poll_create(events, size, flags) \
 	compat_epoll_create(events, size, flags)
 
+#if __GLIBC_PREREQ(2, 9)

src/common/compat/poll.h extern int compat_epoll_create(struct lttng_poll_event · line 139

Quoted 10 lines
src/common/compat/poll.h +9 -0
+static inline int compat_glibc_epoll_create(int size
 __attribute__((unused)),
+		int flags)
+{
+	return epoll_create1(flags);
+}
+#else
+static inline int compat_glibc_epoll_create(int size, int flags)
+{
+	/* epoll_create1 was added in glibc 2.9, but unfortunatly reverting to

Missing newline after /*

src/common/compat/poll.h extern int compat_epoll_create(struct lttng_poll_event · line 140

Quoted 1 line
src/common/compat/poll.h +1 -0
+	 * epoll_create(..) also means that we loose the possibility to

loose -> lose

src/common/compat/poll.h extern int compat_epoll_create(struct lttng_poll_event · line 142

Quoted 2 lines
src/common/compat/poll.h +2 -0
+	 * directly set the EPOLL_CLOEXEC, so try and do it anyway but through
+	 * fcntl(..). */

Missing newline before */

src/common/compat/poll.h extern int compat_epoll_create(struct lttng_poll_event · line 144

Quoted 2 lines
src/common/compat/poll.h +2 -0
+	int efd = epoll_create(size);
+	assert(fcntl(efd, F_SETFD, flags) != -1);

Then assert.h should be included by this header.

Thanks!

Mathieu

Quoted 100 lines
src/common/compat/poll.h +4 -0
+	return efd;
+}
+#endif
+
 /*

* Wait on epoll set with the number of fd registered to the lttng_poll_event
* data structure (events).

src/common/consumer-timer.c +1 -0
index dc6f2f7..c659bf6 100644
@@ -23,6 +23,7 @@
 
 #include <bin/lttng-consumerd/health-consumerd.h>
 #include <common/common.h>
+#include <common/compat/endian.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/kernel-consumer/kernel-consumer.h>
 #include <common/consumer-stream.h>
src/common/consumer.c +1 -0
index e80ac6b..cba4a60 100644
@@ -34,6 +34,7 @@
 #include <common/common.h>
 #include <common/utils.h>
 #include <common/compat/poll.h>
+#include <common/compat/endian.h>
 #include <common/index/index.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/sessiond-comm/relayd.h>
src/common/index/index.c +1 -0
index abc0985..a462a63 100644
@@ -24,6 +24,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/utils.h>
 
 #include "index.h"
src/common/kernel-consumer/kernel-consumer.c +1 -0
index d15329f..57dc2ba 100644
@@ -35,6 +35,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/pipe.h>
 #include <common/relayd/relayd.h>
 #include <common/utils.h>
src/common/relayd/relayd.c +1 -0
index 3de19c2..38ebdbd 100644
@@ -25,6 +25,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/index/ctf-index.h>
 
src/common/ust-consumer/ust-consumer.c +1 -0
index 9f2e739..b8c1a3c 100644
@@ -37,6 +37,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/relayd/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/consumer-metadata-cache.h>
 #include <common/consumer-stream.h>
 #include <common/consumer-timer.h>
tests/regression/tools/live/live_test.c +2 -1
index aff8977..d2c9050 100644
@@ -43,6 +43,8 @@
 #include <bin/lttng-relayd/lttng-viewer-abi.h>
 #include <common/index/ctf-index.h>
 
+#include <common/compat/endian.h>
+
 #define SESSION1 "test1"
 #define RELAYD_URL "net://localhost"
 #define LIVE_TIMER 2000000
--

1.8.4.1

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#5 lore raw
In reply to a message not in the archive

See some additional comments below, but I want to apologize for not following the guidelines once again. I have done all the relevant changes as proposed and will be sending a new patch.

/Jesper

----------------------------------------

Quoted 157 lines

Date: Thu, 24 Apr 2014 06:11:34 +0000
From: [email protected]
To: [email protected]
CC: [email protected]; [email protected]
Subject: Re: [PATCH v3 lttng-tools] Backported to glibc 2.8

----- Original Message -----

Quoted 150 lines

From: "Jesper Derehag" <[email protected]>
To: "mathieu desnoyers" <[email protected]>
Cc: [email protected], [email protected], "Jesper Derehag" <[email protected]>
Sent: Wednesday, April 23, 2014 5:42:30 PM
Subject: [PATCH v3 lttng-tools] Backported to glibc 2.8

This patch enables lttng-tools to run on top of glibc 2.8. Overall it fixes 2 things:
1. No support for epoll_create1(..) and EPOLL_CLOEXEC.
2. No support for htobe/betoh

For 1, we revert back to epoll_create() and then sets CLOEXEC through fcntl instead.
For 2, we define htobe/betoh as part of the compat/endian.h and make sure that any users of those functions actually include compat/endian.h instead of implicit include of system endian.h

---
Compared to v2 this fixes the coding style for comments. I just want to mention that I did run checkpatch for v2 and that it passed. But fixed according to Mr. Desnoyers comments anyway.

src/bin/lttng-relayd/cmd-2-2.c | 2 + src/bin/lttng-relayd/cmd-2-4.c | 2 + src/bin/lttng-relayd/live.c | 1 + src/bin/lttng-relayd/main.c | 1 + src/bin/lttng-sessiond/jul-thread.c | 2 + src/bin/lttng-sessiond/jul.c | 2 + src/common/compat/compat-epoll.c | 2 +- src/common/compat/endian.h | 94
+++++++++++++++++++++++++++-
src/common/compat/poll.h | 29 +++++++++ src/common/consumer-timer.c | 1 + src/common/consumer.c | 1 + src/common/index/index.c | 1 + src/common/kernel-consumer/kernel-consumer.c | 1 + src/common/relayd/relayd.c | 1 + src/common/ust-consumer/ust-consumer.c | 1 + tests/regression/tools/live/live_test.c | 2 +

16 files changed, 141 insertions(+), 2 deletions(-)
src/bin/lttng-relayd/cmd-2-2.c +2 -0
index b7299a5..978a11e 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "cmd-2-1.h"
 #include "utils.h"
src/bin/lttng-relayd/cmd-2-4.c +2 -0
index 3196383..6d927a0 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "lttng-relayd.h"
 
src/bin/lttng-relayd/live.c +1 -0
index c60f7e4..d8517d2 100644
@@ -43,6 +43,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/futex.h>
 #include <common/index/index.h>
src/bin/lttng-relayd/main.c +1 -0
index a93151a..93b08fc 100644
@@ -44,6 +44,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/daemonize.h>
 #include <common/futex.h>
src/bin/lttng-sessiond/jul-thread.c +2 -0
index cc694df..9859a10 100644
@@ -23,6 +23,8 @@
 #include <common/uri.h>
 #include <common/utils.h>
 
+#include <common/compat/endian.h>
+
 #include "fd-limit.h"
 #include "jul-thread.h"
 #include "lttng-sessiond.h"
src/bin/lttng-sessiond/jul.c +2 -0
index 7bb0d75..da4cf67 100644
@@ -22,6 +22,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/jul.h>
 
+#include <common/compat/endian.h>
+
 #include "jul.h"
 #include "ust-app.h"
 #include "utils.h"
src/common/compat/compat-epoll.c +1 -1
index ecd09a0..368fae1 100644
@@ -81,7 +81,7 @@ int compat_epoll_create(struct lttng_poll_event *events,
 int size, int flags)
 size = poll_max_size;
 }
 
- ret = epoll_create1(flags);
+ ret = compat_glibc_epoll_create(size, flags);
 if (ret < 0) {
 /* At this point, every error is fatal */

PERROR("epoll_create1");

src/common/compat/endian.h +1 -1
index 2850866..7ffba9d 100644
@@ -15,11 +15,103 @@
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifdef _COMPAT_ENDIAN_H
+#ifndef _COMPAT_ENDIAN_H
 #define _COMPAT_ENDIAN_H
 
Quoted 12 lines

src/common/compat/endian.h line 29

Quoted 9 lines
src/common/compat/endian.h +7 -0
 #ifdef __linux__
 #include <endian.h>
+
+/*
+ * htobe/betoh are not defined for glibc <2.9, so add them
+ * explicitly if they are missing.
+ */
+#ifdef __USE_BSD
+/* Conversion interfaces.*/

I hate to have to say this, but you might want to add exactly one space between the "." and the "*" above.

I thought it was strange that you wanted me to remove all the spaces, but I misunderstood your previous comment as remove just 1 space and not all spaces.. Sorry about that..

Quoted 144 lines
Quoted 124 lines
src/common/compat/endian.h +85 -0
+# include <byteswap.h>
+
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# ifndef htobe16
+# define htobe16(x) __bswap_16(x)
+# endif
+# ifndef htole16
+# define htole16(x) (x)
+# endif
+# ifndef be16toh
+# define be16toh(x) __bswap_16(x)
+# endif
+# ifndef le16toh
+# define le16toh(x) (x)
+# endif
+
+# ifndef htobe32
+# define htobe32(x) __bswap_32(x)
+# endif
+# ifndef htole32
+# define htole32(x) (x)
+# endif
+# ifndef be32toh
+# define be32toh(x) __bswap_32(x)
+# endif
+# ifndef le32toh
+# define le32toh(x) (x)
+# endif
+
+# ifndef htobe64
+# define htobe64(x) __bswap_64(x)
+# endif
+# ifndef htole64
+# define htole64(x) (x)
+# endif
+# ifndef be64toh
+# define be64toh(x) __bswap_64(x)
+# endif
+# ifndef le64toh
+# define le64toh(x) (x)
+# endif
+
+# else /* __BYTE_ORDER == __LITTLE_ENDIAN */
+# ifndef htobe16
+# define htobe16(x) (x)
+# endif
+# ifndef htole16
+# define htole16(x) __bswap_16(x)
+# endif
+# ifndef be16toh
+# define be16toh(x) (x)
+# endif
+# ifndef le16toh
+# define le16toh(x) __bswap_16(x)
+# endif
+
+# ifndef htobe32
+# define htobe32(x) (x)
+# endif
+# ifndef htole32
+# define htole32(x) __bswap_32(x)
+# endif
+# ifndef be32toh
+# define be32toh(x) (x)
+# endif
+# ifndef le32toh
+# define le32toh(x) __bswap_32(x)
+# endif
+
+# ifndef htobe64
+# define htobe64(x) (x)
+# endif
+# ifndef htole64
+# define htole64(x) __bswap_64(x)
+# endif
+# ifndef be64toh
+# define be64toh(x) (x)
+# endif
+# ifndef le64toh
+# define le64toh(x) __bswap_64(x)
+# endif
+
+# endif /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#endif /* __USE_BSD */
+
 #elif defined(__FreeBSD__)
 #include <machine/endian.h>
 #else
src/common/compat/poll.h +11 -0
index b019b42..90fe813 100644
@@ -52,6 +52,8 @@ static inline void __lttng_poll_free(void *events)
 #ifdef HAVE_EPOLL
 #include <sys/epoll.h>
 #include <stdio.h>
+#include <features.h>
+#include <common/compat/fcntl.h>
 
 /* See man epoll(7) for this define path */
 #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches"
@@ -71,7 +73,15 @@ enum {
 LPOLLNVAL = EPOLLHUP,
 LPOLLRDHUP = EPOLLRDHUP,
 /* Close on exec feature of epoll */
+#if __GLIBC_PREREQ(2, 9)
 LTTNG_CLOEXEC = EPOLL_CLOEXEC,
+#else
+ /* EPOLL_CLOEXEC was added in glibc 2.8 (usually used in conjunction
+ * with epoll_create1(..)), but since neither EPOLL_CLOEXEC exists nor
+ * epoll_create1(..), we set it to FD_CLOEXEC so that we can pass it
+ * directly to fcntl(..) instead */
+ LTTNG_CLOEXEC = FD_CLOEXEC,
+#endif
 };
 
 struct compat_epoll_event {
@@ -115,6 +125,25 @@ extern int compat_epoll_create(struct lttng_poll_event
 *events,
 #define lttng_poll_create(events, size, flags) \
 compat_epoll_create(events, size, flags)
 
+#if __GLIBC_PREREQ(2, 9)

src/common/compat/poll.h extern int compat_epoll_create(struct lttng_poll_event · line 139

Quoted 10 lines
src/common/compat/poll.h +9 -0
+static inline int compat_glibc_epoll_create(int size
 __attribute__((unused)),
+ int flags)
+{
+ return epoll_create1(flags);
+}
+#else
+static inline int compat_glibc_epoll_create(int size, int flags)
+{
+ /* epoll_create1 was added in glibc 2.9, but unfortunatly reverting to

Missing newline after /*

src/common/compat/poll.h extern int compat_epoll_create(struct lttng_poll_event · line 140

Quoted 1 line
src/common/compat/poll.h +1 -0
+ * epoll_create(..) also means that we loose the possibility to

loose -> lose

src/common/compat/poll.h extern int compat_epoll_create(struct lttng_poll_event · line 142

Quoted 2 lines
src/common/compat/poll.h +2 -0
+ * directly set the EPOLL_CLOEXEC, so try and do it anyway but through
+ * fcntl(..). */
Quoted 6 lines

Missing newline before */

src/common/compat/poll.h extern int compat_epoll_create(struct lttng_poll_event · line 144

Quoted 2 lines
src/common/compat/poll.h +2 -0
+ int efd = epoll_create(size);
+ assert(fcntl(efd, F_SETFD, flags) != -1);

Then assert.h should be included by this header.

It is?
I am not the first user of assert in this file, so the assert.h was already present.

Quoted 110 lines

Thanks!

Mathieu

Quoted 97 lines
src/common/compat/poll.h +4 -0
+ return efd;
+}
+#endif
+
 /*

* Wait on epoll set with the number of fd registered to the lttng_poll_event
* data structure (events).

src/common/consumer-timer.c +1 -0
index dc6f2f7..c659bf6 100644
@@ -23,6 +23,7 @@
 
 #include <bin/lttng-consumerd/health-consumerd.h>
 #include <common/common.h>
+#include <common/compat/endian.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/kernel-consumer/kernel-consumer.h>
 #include <common/consumer-stream.h>
src/common/consumer.c +1 -0
index e80ac6b..cba4a60 100644
@@ -34,6 +34,7 @@
 #include <common/common.h>
 #include <common/utils.h>
 #include <common/compat/poll.h>
+#include <common/compat/endian.h>
 #include <common/index/index.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/sessiond-comm/relayd.h>
src/common/index/index.c +1 -0
index abc0985..a462a63 100644
@@ -24,6 +24,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/utils.h>
 
 #include "index.h"
src/common/kernel-consumer/kernel-consumer.c +1 -0
index d15329f..57dc2ba 100644
@@ -35,6 +35,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/pipe.h>
 #include <common/relayd/relayd.h>
 #include <common/utils.h>
src/common/relayd/relayd.c +1 -0
index 3de19c2..38ebdbd 100644
@@ -25,6 +25,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/index/ctf-index.h>
 
src/common/ust-consumer/ust-consumer.c +1 -0
index 9f2e739..b8c1a3c 100644
@@ -37,6 +37,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/relayd/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/consumer-metadata-cache.h>
 #include <common/consumer-stream.h>
 #include <common/consumer-timer.h>
tests/regression/tools/live/live_test.c +2 -1
index aff8977..d2c9050 100644
@@ -43,6 +43,8 @@
 #include <bin/lttng-relayd/lttng-viewer-abi.h>
 #include <common/index/ctf-index.h>
 
+#include <common/compat/endian.h>
+
 #define SESSION1 "test1"
 #define RELAYD_URL "net://localhost"
 #define LIVE_TIMER 2000000
--
Quoted 3 lines

1.8.4.1

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

#6 lore raw

PATCH v4 1/1 Backported to glibc 2.8

In reply to a message not in the archive

This patch enables lttng-tools to run on top of glibc 2.8. Overall it fixes 2 things:
1. No support for epoll_create1(..) and EPOLL_CLOEXEC.
2. No support for htobe/betoh

For 1, we revert back to epoll_create() and then sets CLOEXEC through fcntl instead.
For 2, we define htobe/betoh as part of the compat/endian.h and make sure that any users of those functions actually include compat/endian.h instead of implicit include of system endian.h

---
 src/bin/lttng-relayd/cmd-2-2.c               |  2 +
 src/bin/lttng-relayd/cmd-2-4.c               |  2 +
 src/bin/lttng-relayd/live.c                  |  1 +
 src/bin/lttng-relayd/main.c                  |  1 +
 src/bin/lttng-sessiond/jul-thread.c          |  2 +
 src/bin/lttng-sessiond/jul.c                 |  2 +
 src/common/compat/compat-epoll.c             |  2 +-
 src/common/compat/endian.h                   | 94 +++++++++++++++++++++++++++-
 src/common/compat/poll.h                     | 31 +++++++++
 src/common/consumer-timer.c                  |  1 +
 src/common/consumer.c                        |  1 +
 src/common/index/index.c                     |  1 +
 src/common/kernel-consumer/kernel-consumer.c |  1 +
 src/common/relayd/relayd.c                   |  1 +
 src/common/ust-consumer/ust-consumer.c       |  1 +
 tests/regression/tools/live/live_test.c      |  2 +
 16 files changed, 143 insertions(+), 2 deletions(-)
src/bin/lttng-relayd/cmd-2-2.c +2 -0
index b7299a5..978a11e 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "cmd-2-1.h"
 #include "utils.h"
src/bin/lttng-relayd/cmd-2-4.c +2 -0
index 3196383..6d927a0 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "lttng-relayd.h"
 
src/bin/lttng-relayd/live.c +1 -0
index c60f7e4..d8517d2 100644
@@ -43,6 +43,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/futex.h>
 #include <common/index/index.h>
src/bin/lttng-relayd/main.c +1 -0
index a93151a..93b08fc 100644
@@ -44,6 +44,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/daemonize.h>
 #include <common/futex.h>
src/bin/lttng-sessiond/jul-thread.c +2 -0
index cc694df..9859a10 100644
@@ -23,6 +23,8 @@
 #include <common/uri.h>
 #include <common/utils.h>
 
+#include <common/compat/endian.h>
+
 #include "fd-limit.h"
 #include "jul-thread.h"
 #include "lttng-sessiond.h"
src/bin/lttng-sessiond/jul.c +2 -0
index 7bb0d75..da4cf67 100644
@@ -22,6 +22,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/jul.h>
 
+#include <common/compat/endian.h>
+
 #include "jul.h"
 #include "ust-app.h"
 #include "utils.h"
src/common/compat/compat-epoll.c +1 -1
index ecd09a0..368fae1 100644
@@ -81,7 +81,7 @@ int compat_epoll_create(struct lttng_poll_event *events, int size, int flags)
 		size = poll_max_size;
 	}
 
-	ret = epoll_create1(flags);
+	ret = compat_glibc_epoll_create(size, flags);
 	if (ret < 0) {
 		/* At this point, every error is fatal */
 		PERROR("epoll_create1");
src/common/compat/endian.h +93 -1

104 lines not on this page · raw message

src/common/compat/poll.h +31 -0
index b019b42..40a96d2 100644
@@ -52,6 +52,8 @@ static inline void __lttng_poll_free(void *events)
 #ifdef HAVE_EPOLL
 #include <sys/epoll.h>
 #include <stdio.h>
+#include <features.h>
+#include <common/compat/fcntl.h>
 
 /* See man epoll(7) for this define path */
 #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches"
@@ -71,7 +73,15 @@ enum {
 	LPOLLNVAL = EPOLLHUP,
 	LPOLLRDHUP = EPOLLRDHUP,
 	/* Close on exec feature of epoll */
+#if __GLIBC_PREREQ(2, 9)
 	LTTNG_CLOEXEC = EPOLL_CLOEXEC,
+#else
+	/* EPOLL_CLOEXEC was added in glibc 2.8 (usually used in conjunction
+	 * with epoll_create1(..)), but since neither EPOLL_CLOEXEC exists nor
+	 * epoll_create1(..), we set it to FD_CLOEXEC so that we can pass it
+	 * directly to fcntl(..) instead */
+	LTTNG_CLOEXEC = FD_CLOEXEC,
+#endif
 };
 
 struct compat_epoll_event {
@@ -115,6 +125,27 @@ extern int compat_epoll_create(struct lttng_poll_event *events,
 #define lttng_poll_create(events, size, flags) \
 	compat_epoll_create(events, size, flags)
 
+#if __GLIBC_PREREQ(2, 9)
+static inline int compat_glibc_epoll_create(int size __attribute__((unused)),
+		int flags)
+{
+	return epoll_create1(flags);
+}
+#else
+static inline int compat_glibc_epoll_create(int size, int flags)
+{
+	/*
+	 * epoll_create1 was added in glibc 2.9, but unfortunatly reverting to
+	 * epoll_create(..) also means that we lose the possibility to
+	 * directly set the EPOLL_CLOEXEC, so try and do it anyway but through
+	 * fcntl(..).
+	 */
+	int efd = epoll_create(size);
+	assert(fcntl(efd, F_SETFD, flags) != -1);
+	return efd;
+}
+#endif
+
 /*
  * Wait on epoll set with the number of fd registered to the lttng_poll_event
  * data structure (events).
src/common/consumer-timer.c +1 -0
index dc6f2f7..c659bf6 100644
@@ -23,6 +23,7 @@
 
 #include <bin/lttng-consumerd/health-consumerd.h>
 #include <common/common.h>
+#include <common/compat/endian.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/kernel-consumer/kernel-consumer.h>
 #include <common/consumer-stream.h>
src/common/consumer.c +1 -0
index e80ac6b..cba4a60 100644
@@ -34,6 +34,7 @@
 #include <common/common.h>
 #include <common/utils.h>
 #include <common/compat/poll.h>
+#include <common/compat/endian.h>
 #include <common/index/index.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/sessiond-comm/relayd.h>
src/common/index/index.c +1 -0
index abc0985..a462a63 100644
@@ -24,6 +24,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/utils.h>
 
 #include "index.h"
src/common/kernel-consumer/kernel-consumer.c +1 -0
index d15329f..57dc2ba 100644
@@ -35,6 +35,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/pipe.h>
 #include <common/relayd/relayd.h>
 #include <common/utils.h>
src/common/relayd/relayd.c +1 -0
index 3de19c2..38ebdbd 100644
@@ -25,6 +25,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/index/ctf-index.h>
 
src/common/ust-consumer/ust-consumer.c +1 -0
index 9f2e739..b8c1a3c 100644
@@ -37,6 +37,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/relayd/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/consumer-metadata-cache.h>
 #include <common/consumer-stream.h>
 #include <common/consumer-timer.h>
tests/regression/tools/live/live_test.c +2 -0
index aff8977..d2c9050 100644
@@ -43,6 +43,8 @@
 #include <bin/lttng-relayd/lttng-viewer-abi.h>
 #include <common/index/ctf-index.h>
 
+#include <common/compat/endian.h>
+
 #define SESSION1 "test1"
 #define RELAYD_URL "net://localhost"
 #define LIVE_TIMER 2000000
Signature · 1 line
1.8.4.1
#8 lore raw
In reply to a message not in the archive

----- Original Message -----

Quoted 255 lines

From: "Jesper Derehag" <[email protected]>
To: "mathieu desnoyers" <[email protected]>
Cc: [email protected], [email protected], "Jesper Derehag" <[email protected]>
Sent: Thursday, April 24, 2014 10:22:50 AM
Subject: [PATCH v4 lttng-tools] Backported to glibc 2.8

This patch enables lttng-tools to run on top of glibc 2.8. Overall it fixes 2 things:
1. No support for epoll_create1(..) and EPOLL_CLOEXEC.
2. No support for htobe/betoh

For 1, we revert back to epoll_create() and then sets CLOEXEC through fcntl instead.
For 2, we define htobe/betoh as part of the compat/endian.h and make sure that any users of those functions actually include compat/endian.h instead of implicit include of system endian.h

---
 src/bin/lttng-relayd/cmd-2-2.c               |  2 +
 src/bin/lttng-relayd/cmd-2-4.c               |  2 +
 src/bin/lttng-relayd/live.c                  |  1 +
 src/bin/lttng-relayd/main.c                  |  1 +
 src/bin/lttng-sessiond/jul-thread.c          |  2 +
 src/bin/lttng-sessiond/jul.c                 |  2 +
 src/common/compat/compat-epoll.c             |  2 +-
 src/common/compat/endian.h                   | 94
 +++++++++++++++++++++++++++-
 src/common/compat/poll.h                     | 31 +++++++++
 src/common/consumer-timer.c                  |  1 +
 src/common/consumer.c                        |  1 +
 src/common/index/index.c                     |  1 +
 src/common/kernel-consumer/kernel-consumer.c |  1 +
 src/common/relayd/relayd.c                   |  1 +
 src/common/ust-consumer/ust-consumer.c       |  1 +
 tests/regression/tools/live/live_test.c      |  2 +
 16 files changed, 143 insertions(+), 2 deletions(-)
src/bin/lttng-relayd/cmd-2-2.c +2 -0
index b7299a5..978a11e 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "cmd-2-1.h"
 #include "utils.h"
src/bin/lttng-relayd/cmd-2-4.c +2 -0
index 3196383..6d927a0 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "lttng-relayd.h"
 
src/bin/lttng-relayd/live.c +1 -0
index c60f7e4..d8517d2 100644
@@ -43,6 +43,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/futex.h>
 #include <common/index/index.h>
src/bin/lttng-relayd/main.c +1 -0
index a93151a..93b08fc 100644
@@ -44,6 +44,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/daemonize.h>
 #include <common/futex.h>
src/bin/lttng-sessiond/jul-thread.c +2 -0
index cc694df..9859a10 100644
@@ -23,6 +23,8 @@
 #include <common/uri.h>
 #include <common/utils.h>
 
+#include <common/compat/endian.h>
+
 #include "fd-limit.h"
 #include "jul-thread.h"
 #include "lttng-sessiond.h"
src/bin/lttng-sessiond/jul.c +2 -0
index 7bb0d75..da4cf67 100644
@@ -22,6 +22,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/jul.h>
 
+#include <common/compat/endian.h>
+
 #include "jul.h"
 #include "ust-app.h"
 #include "utils.h"
src/common/compat/compat-epoll.c +1 -1
index ecd09a0..368fae1 100644
@@ -81,7 +81,7 @@ int compat_epoll_create(struct lttng_poll_event *events,
 int size, int flags)
 		size = poll_max_size;
 	}
 
-	ret = epoll_create1(flags);
+	ret = compat_glibc_epoll_create(size, flags);
 	if (ret < 0) {
 		/* At this point, every error is fatal */
src/common/compat/compat-epoll.c +0 -0
 		PERROR("epoll_create1");
src/common/compat/endian.h +93 -1
index 2850866..baea531 100644
@@ -15,11 +15,103 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifdef _COMPAT_ENDIAN_H
+#ifndef _COMPAT_ENDIAN_H
 #define _COMPAT_ENDIAN_H
 
 #ifdef __linux__
 #include <endian.h>
+
+/*
+ * htobe/betoh are not defined for glibc <2.9, so add them
+ * explicitly if they are missing.
+ */
+#ifdef __USE_BSD
+/* Conversion interfaces. */
+# include <byteswap.h>
+
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  ifndef htobe16
+#   define htobe16(x) __bswap_16(x)
+#  endif
+#  ifndef htole16
+#   define htole16(x) (x)
+#  endif
+#  ifndef be16toh
+#   define be16toh(x) __bswap_16(x)
+#  endif
+#  ifndef le16toh
+#   define le16toh(x) (x)
+#  endif
+
+#  ifndef htobe32
+#   define htobe32(x) __bswap_32(x)
+#  endif
+#  ifndef htole32
+#   define htole32(x) (x)
+#  endif
+#  ifndef be32toh
+#   define be32toh(x) __bswap_32(x)
+#  endif
+#  ifndef le32toh
+#   define le32toh(x) (x)
+#  endif
+
+#  ifndef htobe64
+#   define htobe64(x) __bswap_64(x)
+#  endif
+#  ifndef htole64
+#   define htole64(x) (x)
+#  endif
+#  ifndef be64toh
+#   define be64toh(x) __bswap_64(x)
+#  endif
+#  ifndef le64toh
+#   define le64toh(x) (x)
+#  endif
+
+# else /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#  ifndef htobe16
+#   define htobe16(x) (x)
+#  endif
+#  ifndef htole16
+#   define htole16(x) __bswap_16(x)
+#  endif
+#  ifndef be16toh
+#   define be16toh(x) (x)
+#  endif
+#  ifndef le16toh
+#   define le16toh(x) __bswap_16(x)
+#  endif
+
+#  ifndef htobe32
+#   define htobe32(x) (x)
+#  endif
+#  ifndef htole32
+#   define htole32(x) __bswap_32(x)
+#  endif
+#  ifndef be32toh
+#   define be32toh(x) (x)
+#  endif
+#  ifndef le32toh
+#   define le32toh(x) __bswap_32(x)
+#  endif
+
+#  ifndef htobe64
+#   define htobe64(x) (x)
+#  endif
+#  ifndef htole64
+#   define htole64(x) __bswap_64(x)
+#  endif
+#  ifndef be64toh
+#   define be64toh(x) (x)
+#  endif
+#  ifndef le64toh
+#   define le64toh(x) __bswap_64(x)
+#  endif
+
+# endif /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#endif /* __USE_BSD */
+
 #elif defined(__FreeBSD__)
 #include <machine/endian.h>
 #else
src/common/compat/poll.h +2 -0
index b019b42..40a96d2 100644
@@ -52,6 +52,8 @@ static inline void __lttng_poll_free(void *events)
 #ifdef HAVE_EPOLL
 #include <sys/epoll.h>
 #include <stdio.h>
+#include <features.h>
+#include <common/compat/fcntl.h>
 
 /* See man epoll(7) for this define path */
 #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches"

src/common/compat/poll.h enum { · line 82

Quoted 10 lines
src/common/compat/poll.h +6 -0
@@ -71,7 +73,15 @@ enum {
 	LPOLLNVAL = EPOLLHUP,
 	LPOLLRDHUP = EPOLLRDHUP,
 	/* Close on exec feature of epoll */
+#if __GLIBC_PREREQ(2, 9)
 	LTTNG_CLOEXEC = EPOLL_CLOEXEC,
+#else
+	/* EPOLL_CLOEXEC was added in glibc 2.8 (usually used in conjunction
+	 * with epoll_create1(..)), but since neither EPOLL_CLOEXEC exists nor
+	 * epoll_create1(..), we set it to FD_CLOEXEC so that we can pass it
+	 * directly to fcntl(..) instead */

David, can you edit this comment and add the missing newline when you merge this patch ?

Other than that:

Thanks Jesper!

Mathieu

Quoted 128 lines
src/common/compat/poll.h +23 -0
+	LTTNG_CLOEXEC = FD_CLOEXEC,
+#endif
 };
 
 struct compat_epoll_event {
@@ -115,6 +125,27 @@ extern int compat_epoll_create(struct lttng_poll_event
 *events,
 #define lttng_poll_create(events, size, flags) \
 	compat_epoll_create(events, size, flags)
 
+#if __GLIBC_PREREQ(2, 9)
+static inline int compat_glibc_epoll_create(int size
 __attribute__((unused)),
+		int flags)
+{
+	return epoll_create1(flags);
+}
+#else
+static inline int compat_glibc_epoll_create(int size, int flags)
+{
+	/*
+	 * epoll_create1 was added in glibc 2.9, but unfortunatly reverting to
+	 * epoll_create(..) also means that we lose the possibility to
+	 * directly set the EPOLL_CLOEXEC, so try and do it anyway but through
+	 * fcntl(..).
+	 */
+	int efd = epoll_create(size);
+	assert(fcntl(efd, F_SETFD, flags) != -1);
+	return efd;
+}
+#endif
+
 /*

* Wait on epoll set with the number of fd registered to the lttng_poll_event
* data structure (events).

src/common/consumer-timer.c +1 -0
index dc6f2f7..c659bf6 100644
@@ -23,6 +23,7 @@
 
 #include <bin/lttng-consumerd/health-consumerd.h>
 #include <common/common.h>
+#include <common/compat/endian.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/kernel-consumer/kernel-consumer.h>
 #include <common/consumer-stream.h>
src/common/consumer.c +1 -0
index e80ac6b..cba4a60 100644
@@ -34,6 +34,7 @@
 #include <common/common.h>
 #include <common/utils.h>
 #include <common/compat/poll.h>
+#include <common/compat/endian.h>
 #include <common/index/index.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/sessiond-comm/relayd.h>
src/common/index/index.c +1 -0
index abc0985..a462a63 100644
@@ -24,6 +24,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/utils.h>
 
 #include "index.h"
src/common/kernel-consumer/kernel-consumer.c +1 -0
index d15329f..57dc2ba 100644
@@ -35,6 +35,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/pipe.h>
 #include <common/relayd/relayd.h>
 #include <common/utils.h>
src/common/relayd/relayd.c +1 -0
index 3de19c2..38ebdbd 100644
@@ -25,6 +25,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/index/ctf-index.h>
 
src/common/ust-consumer/ust-consumer.c +1 -0
index 9f2e739..b8c1a3c 100644
@@ -37,6 +37,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/relayd/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/consumer-metadata-cache.h>
 #include <common/consumer-stream.h>
 #include <common/consumer-timer.h>
tests/regression/tools/live/live_test.c +2 -1
index aff8977..d2c9050 100644
@@ -43,6 +43,8 @@
 #include <bin/lttng-relayd/lttng-viewer-abi.h>
 #include <common/index/ctf-index.h>
 
+#include <common/compat/endian.h>
+
 #define SESSION1 "test1"
 #define RELAYD_URL "net://localhost"
 #define LIVE_TIMER 2000000
--

1.8.4.1

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#10 lore raw
In reply to a message not in the archive
Quoted 8 lines · Mathieu Desnoyers
Quoted 8 lines

/* See man epoll(7) for this define path */
#define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches"

(quoted diff) +1 -0
@@ -71,7 +73,15 @@ enum {
 	LPOLLNVAL = EPOLLHUP,
 	LPOLLRDHUP = EPOLLRDHUP,
 	/* Close on exec feature of epoll */
+#if __GLIBC_PREREQ(2, 9)
 	LTTNG_CLOEXEC = EPOLL_CLOEXEC,
Quoted 8 lines

Review enum { · line 82

Quoted 5 lines
(quoted diff) +5 -0
+#else
+	/* EPOLL_CLOEXEC was added in glibc 2.8 (usually used in conjunction
+	 * with epoll_create1(..)), but since neither EPOLL_CLOEXEC exists nor
+	 * epoll_create1(..), we set it to FD_CLOEXEC so that we can pass it
+	 * directly to fcntl(..) instead */

David, can you edit this comment and add the missing newline when you merge this patch ?

Don't worry, I'll make it pretty.

I'll be merging this today.

Thanks!
David

Quoted 128 lines

Other than that:

Thanks Jesper!

Mathieu

Quoted 119 lines
(quoted diff) +23 -0
+	LTTNG_CLOEXEC = FD_CLOEXEC,
+#endif
 };
 
 struct compat_epoll_event {
@@ -115,6 +125,27 @@ extern int compat_epoll_create(struct lttng_poll_event
 *events,
 #define lttng_poll_create(events, size, flags) \
 	compat_epoll_create(events, size, flags)
 
+#if __GLIBC_PREREQ(2, 9)
+static inline int compat_glibc_epoll_create(int size
 __attribute__((unused)),
+		int flags)
+{
+	return epoll_create1(flags);
+}
+#else
+static inline int compat_glibc_epoll_create(int size, int flags)
+{
+	/*
+	 * epoll_create1 was added in glibc 2.9, but unfortunatly reverting to
+	 * epoll_create(..) also means that we lose the possibility to
+	 * directly set the EPOLL_CLOEXEC, so try and do it anyway but through
+	 * fcntl(..).
+	 */
+	int efd = epoll_create(size);
+	assert(fcntl(efd, F_SETFD, flags) != -1);
+	return efd;
+}
+#endif
+
 /*

* Wait on epoll set with the number of fd registered to the lttng_poll_event
* data structure (events).

src/common/consumer-timer.c +1 -0
index dc6f2f7..c659bf6 100644
@@ -23,6 +23,7 @@
 
 #include <bin/lttng-consumerd/health-consumerd.h>
 #include <common/common.h>
+#include <common/compat/endian.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/kernel-consumer/kernel-consumer.h>
 #include <common/consumer-stream.h>
src/common/consumer.c +1 -0
index e80ac6b..cba4a60 100644
@@ -34,6 +34,7 @@
 #include <common/common.h>
 #include <common/utils.h>
 #include <common/compat/poll.h>
+#include <common/compat/endian.h>
 #include <common/index/index.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/sessiond-comm/relayd.h>
src/common/index/index.c +1 -0
index abc0985..a462a63 100644
@@ -24,6 +24,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/utils.h>
 
 #include "index.h"
src/common/kernel-consumer/kernel-consumer.c +1 -0
index d15329f..57dc2ba 100644
@@ -35,6 +35,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/pipe.h>
 #include <common/relayd/relayd.h>
 #include <common/utils.h>
src/common/relayd/relayd.c +1 -0
index 3de19c2..38ebdbd 100644
@@ -25,6 +25,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/index/ctf-index.h>
 
src/common/ust-consumer/ust-consumer.c +1 -0
index 9f2e739..b8c1a3c 100644
@@ -37,6 +37,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/relayd/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/consumer-metadata-cache.h>
 #include <common/consumer-stream.h>
 #include <common/consumer-timer.h>
tests/regression/tools/live/live_test.c +0 -0
index aff8977..d2c9050 100644
@@ -43,6 +43,8 @@
 #include <bin/lttng-relayd/lttng-viewer-abi.h>
 #include <common/index/ctf-index.h>
 
Quoted 14 lines
Quoted 9 lines
tests/regression/tools/live/live_test.c +2 -1
+#include <common/compat/endian.h>
+
 #define SESSION1 "test1"
 #define RELAYD_URL "net://localhost"
 #define LIVE_TIMER 2000000
--

1.8.4.1

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#11 lore raw
In reply to a message not in the archive

Merged!

Thanks

Quoted 376 lines · Jesper Derehag

This patch enables lttng-tools to run on top of glibc 2.8. Overall it fixes 2 things:
1. No support for epoll_create1(..) and EPOLL_CLOEXEC.
2. No support for htobe/betoh

For 1, we revert back to epoll_create() and then sets CLOEXEC through fcntl instead.
For 2, we define htobe/betoh as part of the compat/endian.h and make sure that any users of those functions actually include compat/endian.h instead of implicit include of system endian.h

---
 src/bin/lttng-relayd/cmd-2-2.c               |  2 +
 src/bin/lttng-relayd/cmd-2-4.c               |  2 +
 src/bin/lttng-relayd/live.c                  |  1 +
 src/bin/lttng-relayd/main.c                  |  1 +
 src/bin/lttng-sessiond/jul-thread.c          |  2 +
 src/bin/lttng-sessiond/jul.c                 |  2 +
 src/common/compat/compat-epoll.c             |  2 +-
 src/common/compat/endian.h                   | 94 +++++++++++++++++++++++++++-
 src/common/compat/poll.h                     | 31 +++++++++
 src/common/consumer-timer.c                  |  1 +
 src/common/consumer.c                        |  1 +
 src/common/index/index.c                     |  1 +
 src/common/kernel-consumer/kernel-consumer.c |  1 +
 src/common/relayd/relayd.c                   |  1 +
 src/common/ust-consumer/ust-consumer.c       |  1 +
 tests/regression/tools/live/live_test.c      |  2 +
 16 files changed, 143 insertions(+), 2 deletions(-)
src/bin/lttng-relayd/cmd-2-2.c +2 -0
index b7299a5..978a11e 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "cmd-2-1.h"
 #include "utils.h"
src/bin/lttng-relayd/cmd-2-4.c +2 -0
index 3196383..6d927a0 100644
@@ -23,6 +23,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
 
+#include <common/compat/endian.h>
+
 #include "cmd-generic.h"
 #include "lttng-relayd.h"
 
src/bin/lttng-relayd/live.c +1 -0
index c60f7e4..d8517d2 100644
@@ -43,6 +43,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/futex.h>
 #include <common/index/index.h>
src/bin/lttng-relayd/main.c +1 -0
index a93151a..93b08fc 100644
@@ -44,6 +44,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/daemonize.h>
 #include <common/futex.h>
src/bin/lttng-sessiond/jul-thread.c +2 -0
index cc694df..9859a10 100644
@@ -23,6 +23,8 @@
 #include <common/uri.h>
 #include <common/utils.h>
 
+#include <common/compat/endian.h>
+
 #include "fd-limit.h"
 #include "jul-thread.h"
 #include "lttng-sessiond.h"
src/bin/lttng-sessiond/jul.c +2 -0
index 7bb0d75..da4cf67 100644
@@ -22,6 +22,8 @@
 #include <common/common.h>
 #include <common/sessiond-comm/jul.h>
 
+#include <common/compat/endian.h>
+
 #include "jul.h"
 #include "ust-app.h"
 #include "utils.h"
src/common/compat/compat-epoll.c +1 -1
index ecd09a0..368fae1 100644
@@ -81,7 +81,7 @@ int compat_epoll_create(struct lttng_poll_event *events, int size, int flags)
 		size = poll_max_size;
 	}
 
-	ret = epoll_create1(flags);
+	ret = compat_glibc_epoll_create(size, flags);
 	if (ret < 0) {
 		/* At this point, every error is fatal */
 		PERROR("epoll_create1");
src/common/compat/endian.h +93 -1
index 2850866..baea531 100644
@@ -15,11 +15,103 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifdef _COMPAT_ENDIAN_H
+#ifndef _COMPAT_ENDIAN_H
 #define _COMPAT_ENDIAN_H
 
 #ifdef __linux__
 #include <endian.h>
+
+/*
+ * htobe/betoh are not defined for glibc <2.9, so add them
+ * explicitly if they are missing.
+ */
+#ifdef __USE_BSD
+/* Conversion interfaces. */
+# include <byteswap.h>
+
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  ifndef htobe16
+#   define htobe16(x) __bswap_16(x)
+#  endif
+#  ifndef htole16
+#   define htole16(x) (x)
+#  endif
+#  ifndef be16toh
+#   define be16toh(x) __bswap_16(x)
+#  endif
+#  ifndef le16toh
+#   define le16toh(x) (x)
+#  endif
+
+#  ifndef htobe32
+#   define htobe32(x) __bswap_32(x)
+#  endif
+#  ifndef htole32
+#   define htole32(x) (x)
+#  endif
+#  ifndef be32toh
+#   define be32toh(x) __bswap_32(x)
+#  endif
+#  ifndef le32toh
+#   define le32toh(x) (x)
+#  endif
+
+#  ifndef htobe64
+#   define htobe64(x) __bswap_64(x)
+#  endif
+#  ifndef htole64
+#   define htole64(x) (x)
+#  endif
+#  ifndef be64toh
+#   define be64toh(x) __bswap_64(x)
+#  endif
+#  ifndef le64toh
+#   define le64toh(x) (x)
+#  endif
+
+# else /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#  ifndef htobe16
+#   define htobe16(x) (x)
+#  endif
+#  ifndef htole16
+#   define htole16(x) __bswap_16(x)
+#  endif
+#  ifndef be16toh
+#   define be16toh(x) (x)
+#  endif
+#  ifndef le16toh
+#   define le16toh(x) __bswap_16(x)
+#  endif
+
+#  ifndef htobe32
+#   define htobe32(x) (x)
+#  endif
+#  ifndef htole32
+#   define htole32(x) __bswap_32(x)
+#  endif
+#  ifndef be32toh
+#   define be32toh(x) (x)
+#  endif
+#  ifndef le32toh
+#   define le32toh(x) __bswap_32(x)
+#  endif
+
+#  ifndef htobe64
+#   define htobe64(x) (x)
+#  endif
+#  ifndef htole64
+#   define htole64(x) __bswap_64(x)
+#  endif
+#  ifndef be64toh
+#   define be64toh(x) (x)
+#  endif
+#  ifndef le64toh
+#   define le64toh(x) __bswap_64(x)
+#  endif
+
+# endif /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#endif /* __USE_BSD */
+
 #elif defined(__FreeBSD__)
 #include <machine/endian.h>
 #else
src/common/compat/poll.h +31 -0
index b019b42..40a96d2 100644
@@ -52,6 +52,8 @@ static inline void __lttng_poll_free(void *events)
 #ifdef HAVE_EPOLL
 #include <sys/epoll.h>
 #include <stdio.h>
+#include <features.h>
+#include <common/compat/fcntl.h>
 
 /* See man epoll(7) for this define path */
 #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches"
@@ -71,7 +73,15 @@ enum {
 	LPOLLNVAL = EPOLLHUP,
 	LPOLLRDHUP = EPOLLRDHUP,
 	/* Close on exec feature of epoll */
+#if __GLIBC_PREREQ(2, 9)
 	LTTNG_CLOEXEC = EPOLL_CLOEXEC,
+#else
+	/* EPOLL_CLOEXEC was added in glibc 2.8 (usually used in conjunction
+	 * with epoll_create1(..)), but since neither EPOLL_CLOEXEC exists nor
+	 * epoll_create1(..), we set it to FD_CLOEXEC so that we can pass it
+	 * directly to fcntl(..) instead */
+	LTTNG_CLOEXEC = FD_CLOEXEC,
+#endif
 };
 
 struct compat_epoll_event {
@@ -115,6 +125,27 @@ extern int compat_epoll_create(struct lttng_poll_event *events,
 #define lttng_poll_create(events, size, flags) \
 	compat_epoll_create(events, size, flags)
 
+#if __GLIBC_PREREQ(2, 9)
+static inline int compat_glibc_epoll_create(int size __attribute__((unused)),
+		int flags)
+{
+	return epoll_create1(flags);
+}
+#else
+static inline int compat_glibc_epoll_create(int size, int flags)
+{
+	/*
+	 * epoll_create1 was added in glibc 2.9, but unfortunatly reverting to
+	 * epoll_create(..) also means that we lose the possibility to
+	 * directly set the EPOLL_CLOEXEC, so try and do it anyway but through
+	 * fcntl(..).
+	 */
+	int efd = epoll_create(size);
+	assert(fcntl(efd, F_SETFD, flags) != -1);
+	return efd;
+}
+#endif
+
 /*
  * Wait on epoll set with the number of fd registered to the lttng_poll_event
  * data structure (events).
src/common/consumer-timer.c +1 -0
index dc6f2f7..c659bf6 100644
@@ -23,6 +23,7 @@
 
 #include <bin/lttng-consumerd/health-consumerd.h>
 #include <common/common.h>
+#include <common/compat/endian.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/kernel-consumer/kernel-consumer.h>
 #include <common/consumer-stream.h>
src/common/consumer.c +1 -0
index e80ac6b..cba4a60 100644
@@ -34,6 +34,7 @@
 #include <common/common.h>
 #include <common/utils.h>
 #include <common/compat/poll.h>
+#include <common/compat/endian.h>
 #include <common/index/index.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/sessiond-comm/relayd.h>
src/common/index/index.c +1 -0
index abc0985..a462a63 100644
@@ -24,6 +24,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/utils.h>
 
 #include "index.h"
src/common/kernel-consumer/kernel-consumer.c +1 -0
index d15329f..57dc2ba 100644
@@ -35,6 +35,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/pipe.h>
 #include <common/relayd/relayd.h>
 #include <common/utils.h>
src/common/relayd/relayd.c +1 -0
index 3de19c2..38ebdbd 100644
@@ -25,6 +25,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/compat/endian.h>
 #include <common/sessiond-comm/relayd.h>
 #include <common/index/ctf-index.h>
 
src/common/ust-consumer/ust-consumer.c +1 -0
index 9f2e739..b8c1a3c 100644
@@ -37,6 +37,7 @@
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/relayd/relayd.h>
 #include <common/compat/fcntl.h>
+#include <common/compat/endian.h>
 #include <common/consumer-metadata-cache.h>
 #include <common/consumer-stream.h>
 #include <common/consumer-timer.h>
tests/regression/tools/live/live_test.c +2 -0
index aff8977..d2c9050 100644
@@ -43,6 +43,8 @@
 #include <bin/lttng-relayd/lttng-viewer-abi.h>
 #include <common/index/ctf-index.h>
 
+#include <common/compat/endian.h>
+
 #define SESSION1 "test1"
 #define RELAYD_URL "net://localhost"
 #define LIVE_TIMER 2000000
Signature · 1 line
1.8.4.1

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev