From mboxrd@z Thu Jan 1 00:00:00 1970 From: ylamarre@efficios.com (Yannick Lamarre) Date: Thu, 25 Apr 2019 18:23:29 -0400 Subject: [lttng-dev] [PATCH lttng-tools v6 3/8] Change LTTNG_POLL_GETNB behaviour for poll flavor In-Reply-To: <20190425222334.30349-1-ylamarre@efficios.com> References: <20190425222334.30349-1-ylamarre@efficios.com> Message-ID: <20190425222334.30349-4-ylamarre@efficios.com> Modify LTTNG_POLL_GETNB to provide compatibility with the epoll flavor. Since it is only used after a lttng_poll_wait call with no modification (add, del, mod) between, this change does not modify the behaviour in its current usage while ensuring similar API behavior between compatibility layer implementations. Signed-off-by: Yannick Lamarre --- src/common/compat/poll.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/compat/poll.h b/src/common/compat/poll.h index fde54ddb..5eb7ff9c 100644 --- a/src/common/compat/poll.h +++ b/src/common/compat/poll.h @@ -315,10 +315,12 @@ static inline int __lttng_poll_get_prev_fd(struct lttng_poll_event *events, /* * For the following calls, consider 'e' to be a lttng_poll_event pointer and i * being the index of the events array. + * LTTNG_POLL_GETNB is always used after lttng_poll_wait, thus we can use the + * current list for test compatibility purposes. */ #define LTTNG_POLL_GETFD(e, i) LTTNG_REF(e)->wait.events[i].fd #define LTTNG_POLL_GETEV(e, i) LTTNG_REF(e)->wait.events[i].revents -#define LTTNG_POLL_GETNB(e) LTTNG_REF(e)->wait.nb_fd +#define LTTNG_POLL_GETNB(e) LTTNG_REF(e)->current.nb_fd #define LTTNG_POLL_GETSZ(e) LTTNG_REF(e)->wait.events_size #define LTTNG_POLL_GET_PREV_FD(e, i, nb_fd) \ __lttng_poll_get_prev_fd(LTTNG_REF(e), i, nb_fd) -- 2.11.0