[lttng-dev] [PATCH v4 lttng-tools] Backported to glibc 2.8

David Goulet dgoulet at efficios.com
Thu Apr 24 09:55:16 EDT 2014


On 24 Apr (08:58:19), Mathieu Desnoyers wrote:
> >  /* 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 */
> 
> 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

> 
> Other than that:
> 
> Acked-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> 
> Thanks Jesper!
> 
> Mathieu
> 
> > +	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).
> > diff --git a/src/common/consumer-timer.c b/src/common/consumer-timer.c
> > index dc6f2f7..c659bf6 100644
> > --- a/src/common/consumer-timer.c
> > +++ b/src/common/consumer-timer.c
> > @@ -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>
> > diff --git a/src/common/consumer.c b/src/common/consumer.c
> > index e80ac6b..cba4a60 100644
> > --- a/src/common/consumer.c
> > +++ b/src/common/consumer.c
> > @@ -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>
> > diff --git a/src/common/index/index.c b/src/common/index/index.c
> > index abc0985..a462a63 100644
> > --- a/src/common/index/index.c
> > +++ b/src/common/index/index.c
> > @@ -24,6 +24,7 @@
> >  
> >  #include <common/common.h>
> >  #include <common/defaults.h>
> > +#include <common/compat/endian.h>
> >  #include <common/utils.h>
> >  
> >  #include "index.h"
> > diff --git a/src/common/kernel-consumer/kernel-consumer.c
> > b/src/common/kernel-consumer/kernel-consumer.c
> > index d15329f..57dc2ba 100644
> > --- a/src/common/kernel-consumer/kernel-consumer.c
> > +++ b/src/common/kernel-consumer/kernel-consumer.c
> > @@ -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>
> > diff --git a/src/common/relayd/relayd.c b/src/common/relayd/relayd.c
> > index 3de19c2..38ebdbd 100644
> > --- a/src/common/relayd/relayd.c
> > +++ b/src/common/relayd/relayd.c
> > @@ -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>
> >  
> > diff --git a/src/common/ust-consumer/ust-consumer.c
> > b/src/common/ust-consumer/ust-consumer.c
> > index 9f2e739..b8c1a3c 100644
> > --- a/src/common/ust-consumer/ust-consumer.c
> > +++ b/src/common/ust-consumer/ust-consumer.c
> > @@ -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>
> > diff --git a/tests/regression/tools/live/live_test.c
> > b/tests/regression/tools/live/live_test.c
> > index aff8977..d2c9050 100644
> > --- a/tests/regression/tools/live/live_test.c
> > +++ b/tests/regression/tools/live/live_test.c
> > @@ -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
> > 
> > 
> 
> -- 
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 603 bytes
Desc: Digital signature
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20140424/4fd24ed7/attachment.sig>


More information about the lttng-dev mailing list