summaryrefslogtreecommitdiff
path: root/sql/threadpool_unix.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2013-05-27 16:35:42 +0200
committerVladislav Vaintroub <wlad@montyprogram.com>2013-05-27 16:35:42 +0200
commitef1e767ae37d82bf821bda5062989a05917b7211 (patch)
tree8ae561c7742fb76464bee0b9e32371eff85eca00 /sql/threadpool_unix.cc
parent9bc4c4183df327140b5f477993f10f08282d977f (diff)
downloadmariadb-git-ef1e767ae37d82bf821bda5062989a05917b7211.tar.gz
MDEV-4553 - Fixes for compilation under NetBSD.
Diffstat (limited to 'sql/threadpool_unix.cc')
-rw-r--r--sql/threadpool_unix.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc
index 94251660e37..41fe87e19d3 100644
--- a/sql/threadpool_unix.cc
+++ b/sql/threadpool_unix.cc
@@ -286,6 +286,20 @@ static void *native_event_get_userdata(native_event *event)
}
#elif defined(HAVE_KQUEUE)
+
+/*
+ NetBSD is incompatible with other BSDs , last parameter in EV_SET macro
+ (udata, user data) needs to be intptr_t, whereas it needs to be void*
+ everywhere else.
+*/
+
+#ifdef __NetBSD__
+#define MY_EV_SET(a, b, c, d, e, f, g) EV_SET(a, b, c, d, e, f, (intptr_t)g)
+#else
+#define MY_EV_SET(a, b, c, d, e, f, g) EV_SET(a, b, c, d, e, f, g)
+#endif
+
+
int io_poll_create()
{
return kqueue();
@@ -294,7 +308,7 @@ int io_poll_create()
int io_poll_start_read(int pollfd, int fd, void *data)
{
struct kevent ke;
- EV_SET(&ke, fd, EVFILT_READ, EV_ADD|EV_ONESHOT,
+ MY_EV_SET(&ke, fd, EVFILT_READ, EV_ADD|EV_ONESHOT,
0, 0, data);
return kevent(pollfd, &ke, 1, 0, 0, 0);
}
@@ -303,7 +317,7 @@ int io_poll_start_read(int pollfd, int fd, void *data)
int io_poll_associate_fd(int pollfd, int fd, void *data)
{
struct kevent ke;
- EV_SET(&ke, fd, EVFILT_READ, EV_ADD|EV_ONESHOT,
+ MY_EV_SET(&ke, fd, EVFILT_READ, EV_ADD|EV_ONESHOT,
0, 0, data);
return io_poll_start_read(pollfd,fd, data);
}
@@ -312,7 +326,7 @@ int io_poll_associate_fd(int pollfd, int fd, void *data)
int io_poll_disassociate_fd(int pollfd, int fd)
{
struct kevent ke;
- EV_SET(&ke,fd, EVFILT_READ, EV_DELETE, 0, 0, NULL);
+ MY_EV_SET(&ke,fd, EVFILT_READ, EV_DELETE, 0, 0, 0);
return kevent(pollfd, &ke, 1, 0, 0, 0);
}
@@ -337,7 +351,7 @@ int io_poll_wait(int pollfd, struct kevent *events, int maxevents, int timeout_m
static void* native_event_get_userdata(native_event *event)
{
- return event->udata;
+ return (void *)event->udata;
}
#elif defined (__sun)