X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Fpoll.h;h=e3a13cedecfeda3768b2df2718ccf0e5af3b4d04;hb=ca2eb7f43cf00d12f563905d741a6789c3d130ee;hp=1580a4fb211a24def1146d7ec5c721431c34e3b4;hpb=65b1b1983d46c85ee8754c24c108a0df79a60559;p=lttng-tools.git diff --git a/src/common/compat/poll.h b/src/common/compat/poll.h index 1580a4fb2..e3a13cede 100644 --- a/src/common/compat/poll.h +++ b/src/common/compat/poll.h @@ -50,6 +50,7 @@ static inline void __lttng_poll_free(void *events) */ #ifdef HAVE_EPOLL #include +#include /* See man epoll(7) for this define path */ #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches" @@ -146,8 +147,13 @@ static inline void lttng_poll_reset(struct lttng_poll_event *events) */ static inline void lttng_poll_clean(struct lttng_poll_event *events) { + int ret; + if (events) { - close(events->epfd); + ret = close(events->epfd); + if (ret) { + perror("close"); + } __lttng_poll_free((void *) events->events); } } @@ -179,10 +185,17 @@ enum { LPOLLRDBAND = POLLRDBAND, LPOLLWRNORM = POLLWRNORM, LPOLLWRBAND = POLLWRBAND, +#if __linux__ LPOLLMSG = POLLMSG, + LPOLLRDHUP = POLLRDHUP, +#elif defined(__FreeBSD__) + LPOLLMSG = 0, + LPOLLRDHUP = 0, +#else +#error "Please add support for your OS." +#endif /* __linux__ */ LPOLLERR = POLLERR, LPOLLHUP = POLLHUP | POLLNVAL, - LPOLLRDHUP = POLLRDHUP, /* Close on exec feature does not exist for poll(2) */ LTTNG_CLOEXEC = 0xdead, };