[lttng-dev] [PATCH lttng-tools 3/8] Change LTTNG_POLL_GETNB behaviour for poll flavor

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Mar 20 15:22:37 EDT 2019



----- On Mar 19, 2019, at 5:17 PM, Yannick Lamarre ylamarre at efficios.com wrote:

> LTTNG_POLL_GETNB was modified to provide compatibility with the epoll

LTTNG_POLL_GETNB was modified -> Modify LTTNG_POLL_GETNB...

(use present, not past)

> 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 still providing test compatibility.

still providing test compatibility -> ensuring similar API behavior between
compatibility layer implementations.

> 
> Signed-off-by: Yannick Lamarre <ylamarre at efficios.com>
> ---
> src/common/compat/poll.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/common/compat/poll.h b/src/common/compat/poll.h
> index fde54ddb..7dd8741b 100644
> --- a/src/common/compat/poll.h
> +++ b/src/common/compat/poll.h
> @@ -315,10 +315,14 @@ 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 was modified to provide compatibility with the epoll

No reason to describe the evolution of the code in a comment. We document
what is there now.

Thanks,

Mathieu

> + * 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 still providing test compatibility.
>  */
> #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
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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


More information about the lttng-dev mailing list