Commit ef1e767a authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-4553 - Fixes for compilation under NetBSD.

parent 9bc4c418
......@@ -1436,6 +1436,7 @@ static inline char *dlerror(void)
#endif
/* Provide __func__ macro definition for platforms that miss it. */
#if !defined (__func__)
#if __STDC_VERSION__ < 199901L
# if __GNUC__ >= 2
# define __func__ __FUNCTION__
......@@ -1453,6 +1454,7 @@ static inline char *dlerror(void)
#else
# define __func__ "<unknown>"
#endif
#endif /* !defined(__func__) */
#ifndef HAVE_RINT
/**
......
......@@ -119,7 +119,6 @@ int pthread_cancel(pthread_t thread);
#define HAVE_LOCALTIME_R 1
#define _REENTRANT 1
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
#define PTHREAD_STACK_MIN 65536
#undef SAFE_MUTEX /* This will cause conflicts */
#define pthread_key(T,V) DWORD V
......@@ -857,6 +856,11 @@ extern uint thd_lib_detected;
#define mysql_mutex_record_order(A,B) do { } while(0)
#endif
/* At least Windows and NetBSD do not have this definition */
#ifndef PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN 65536
#endif
#ifdef __cplusplus
}
#endif
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment