Mercurial > hg > dhcpcd
changeset 2983:60e6a1e9b245 draft
Fix compile on FreeBSD
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Wed, 04 Mar 2015 17:28:27 +0000 |
| parents | b5e381584efe |
| children | f1073cedc828 |
| files | configure eloop.c |
| diffstat | 2 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/configure Wed Mar 04 16:40:21 2015 +0000 +++ b/configure Wed Mar 04 17:28:27 2015 +0000 @@ -792,6 +792,7 @@ if [ -z "$POLL" ]; then printf "Testing for kqueue1 ... " cat <<EOF >_kqueue.c +#include <sys/types.h> #include <sys/event.h> int main(void) { return kqueue1(0); @@ -808,6 +809,7 @@ if [ -z "$POLL" ]; then printf "Testing for kqueue ... " cat <<EOF >_kqueue.c +#include <sys/types.h> #include <sys/event.h> int main(void) { return kqueue();
--- a/eloop.c Wed Mar 04 16:40:21 2015 +0000 +++ b/eloop.c Wed Mar 04 17:28:27 2015 +0000 @@ -36,6 +36,7 @@ #include <stdlib.h> #include <string.h> #include <syslog.h> +#include <unistd.h> #include "config.h" #include "common.h" @@ -46,10 +47,13 @@ #include <sys/event.h> #include <fcntl.h> #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 @@ 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 @@ #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,
