From: Roy Marples Date: Wed, 4 Mar 2015 17:28:27 +0000 (+0000) Subject: Fix compile on FreeBSD X-Git-Tag: v6.8.0~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=940aaf18e758c872cf68bc4213e2d735e729f601;p=thirdparty%2Fdhcpcd.git Fix compile on FreeBSD --- diff --git a/configure b/configure index 2f88536e..001711d8 100755 --- a/configure +++ b/configure @@ -792,6 +792,7 @@ fi if [ -z "$POLL" ]; then printf "Testing for kqueue1 ... " cat <_kqueue.c +#include #include int main(void) { return kqueue1(0); @@ -808,6 +809,7 @@ fi if [ -z "$POLL" ]; then printf "Testing for kqueue ... " cat <_kqueue.c +#include #include int main(void) { return kqueue(); diff --git a/eloop.c b/eloop.c index 1e0f6e54..89397281 100644 --- a/eloop.c +++ b/eloop.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "config.h" #include "common.h" @@ -46,10 +47,13 @@ #include #include #ifdef __NetBSD__ -/* udata is void * except on NetBSD */ -#define UPTR(x) ((intptr_t)(x)) +/* udata is void * except on NetBSD + * lengths are int except on NetBSD */ +#define UPTR(x) ((intptr_t)(x)) +#define LENC(x) (x) #else -#define UPTR(x) (x) +#define UPTR(x) (x) +#define LENC(x) ((int)(x)) #endif #define eloop_event_setup_fds(ctx) #elif defined(HAVE_EPOLL) @@ -391,7 +395,7 @@ eloop_init(void) for (i = 0; i < dhcpcd_handlesigs[i]; i++) EV_SET(&ctx->fds[i], dhcpcd_handlesigs[i], EVFILT_SIGNAL, EV_ADD, 0, 0, UPTR(NULL)); - if (kevent(ctx->kqueue_fd, ctx->fds, ctx->fds_len, + if (kevent(ctx->kqueue_fd, ctx->fds, LENC(ctx->fds_len), NULL, 0, NULL) == -1) { free(ctx->fds); @@ -505,8 +509,8 @@ eloop_start(struct dhcpcd_ctx *dctx) #endif #ifdef HAVE_KQUEUE - n = kevent(ctx->kqueue_fd, NULL, 0, ctx->fds, ctx->events_len, - tsp); + n = kevent(ctx->kqueue_fd, NULL, 0, + ctx->fds, LENC(ctx->events_len), tsp); #elif HAVE_EPOLL #ifdef USE_SIGNALS n = epoll_pwait(ctx->epoll_fd, ctx->fds, (int)ctx->events_len,