Commit d80b8442 authored by Monty's avatar Monty

Fixes needed to compile with musl C library

Patch originally by Codarren Velvindron
parent 07b8aefe
...@@ -199,6 +199,7 @@ CHECK_INCLUDE_FILES (netinet/in.h HAVE_NETINET_IN_H) ...@@ -199,6 +199,7 @@ CHECK_INCLUDE_FILES (netinet/in.h HAVE_NETINET_IN_H)
CHECK_INCLUDE_FILES (paths.h HAVE_PATHS_H) CHECK_INCLUDE_FILES (paths.h HAVE_PATHS_H)
CHECK_INCLUDE_FILES (port.h HAVE_PORT_H) CHECK_INCLUDE_FILES (port.h HAVE_PORT_H)
CHECK_INCLUDE_FILES (poll.h HAVE_POLL_H) CHECK_INCLUDE_FILES (poll.h HAVE_POLL_H)
CHECK_INCLUDE_FILES (sys/poll.h HAVE_SYS_POLL_H)
CHECK_INCLUDE_FILES (pwd.h HAVE_PWD_H) CHECK_INCLUDE_FILES (pwd.h HAVE_PWD_H)
CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H) CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H)
CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H) CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H)
......
...@@ -36,9 +36,11 @@ C_MODE_START ...@@ -36,9 +36,11 @@ C_MODE_START
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#ifdef HAVE_POLL #if defined(HAVE_POLL_H)
#include <poll.h>
#elif defined(HAVE_SYS_POLL_H)
#include <sys/poll.h> #include <sys/poll.h>
#endif #endif /* defined(HAVE_POLL_H) */
#ifdef HAVE_SYS_IOCTL_H #ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
......
...@@ -47,9 +47,11 @@ ...@@ -47,9 +47,11 @@
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#endif /* !defined(__WIN__) */ #endif /* !defined(__WIN__) */
#ifdef HAVE_POLL #if defined(HAVE_POLL_H)
#include <poll.h>
#elif defined(HAVE_SYS_POLL_H)
#include <sys/poll.h> #include <sys/poll.h>
#endif #endif /* defined(HAVE_POLL_H) */
#ifdef HAVE_SYS_UN_H #ifdef HAVE_SYS_UN_H
#include <sys/un.h> #include <sys/un.h>
#endif #endif
......
...@@ -348,7 +348,7 @@ grn_com_event_add(grn_ctx *ctx, grn_com_event *ev, grn_sock fd, int events, grn_ ...@@ -348,7 +348,7 @@ grn_com_event_add(grn_ctx *ctx, grn_com_event *ev, grn_sock fd, int events, grn_
struct epoll_event e; struct epoll_event e;
memset(&e, 0, sizeof(struct epoll_event)); memset(&e, 0, sizeof(struct epoll_event));
e.data.fd = (fd); e.data.fd = (fd);
e.events = (__uint32_t) events; e.events = (uint32_t) events;
if (epoll_ctl(ev->epfd, EPOLL_CTL_ADD, (fd), &e) == -1) { if (epoll_ctl(ev->epfd, EPOLL_CTL_ADD, (fd), &e) == -1) {
SERR("epoll_ctl"); SERR("epoll_ctl");
return ctx->rc; return ctx->rc;
...@@ -396,7 +396,7 @@ grn_com_event_mod(grn_ctx *ctx, grn_com_event *ev, grn_sock fd, int events, grn_ ...@@ -396,7 +396,7 @@ grn_com_event_mod(grn_ctx *ctx, grn_com_event *ev, grn_sock fd, int events, grn_
struct epoll_event e; struct epoll_event e;
memset(&e, 0, sizeof(struct epoll_event)); memset(&e, 0, sizeof(struct epoll_event));
e.data.fd = (fd); e.data.fd = (fd);
e.events = (__uint32_t) events; e.events = (uint32_t) events;
if (epoll_ctl(ev->epfd, EPOLL_CTL_MOD, (fd), &e) == -1) { if (epoll_ctl(ev->epfd, EPOLL_CTL_MOD, (fd), &e) == -1) {
SERR("epoll_ctl"); SERR("epoll_ctl");
return ctx->rc; return ctx->rc;
......
...@@ -83,7 +83,11 @@ GRN_API grn_com_queue_entry *grn_com_queue_deque(grn_ctx *ctx, grn_com_queue *q) ...@@ -83,7 +83,11 @@ GRN_API grn_com_queue_entry *grn_com_queue_deque(grn_ctx *ctx, grn_com_queue *q)
# define GRN_COM_POLLIN EVFILT_READ # define GRN_COM_POLLIN EVFILT_READ
# define GRN_COM_POLLOUT EVFILT_WRITE # define GRN_COM_POLLOUT EVFILT_WRITE
# else /* USE_KQUEUE */ # else /* USE_KQUEUE */
# include <sys/poll.h> # if defined(HAVE_POLL_H)
# include <poll.h>
# elif defined(HAVE_SYS_POLL_H)
# include <sys/poll.h>
# endif /* defined(HAVE_POLL_H) */
# define GRN_COM_POLLIN POLLIN # define GRN_COM_POLLIN POLLIN
# define GRN_COM_POLLOUT POLLOUT # define GRN_COM_POLLOUT POLLOUT
# endif /* USE_KQUEUE */ # endif /* USE_KQUEUE */
......
...@@ -93,7 +93,7 @@ if (NOT HAVE_BACKTRACE_WITHOUT_EXECINFO) ...@@ -93,7 +93,7 @@ if (NOT HAVE_BACKTRACE_WITHOUT_EXECINFO)
if (HAVE_BACKTRACE_WITH_EXECINFO) if (HAVE_BACKTRACE_WITH_EXECINFO)
list(APPEND EXTRA_SYSTEM_LIBS execinfo) list(APPEND EXTRA_SYSTEM_LIBS execinfo)
else () else ()
message(FATAL_ERROR "Cannot find backtrace(), even with -lexecinfo.") message(WARNING "Cannot find backtrace(), even with -lexecinfo.")
endif () endif ()
endif () endif ()
......
...@@ -831,7 +831,7 @@ void my_strerror(char *buf, size_t len, int nr) ...@@ -831,7 +831,7 @@ void my_strerror(char *buf, size_t len, int nr)
(defined _XOPEN_SOURCE && (_XOPEN_SOURCE >= 600))) && \ (defined _XOPEN_SOURCE && (_XOPEN_SOURCE >= 600))) && \
! defined _GNU_SOURCE ! defined _GNU_SOURCE
strerror_r(nr, buf, len); /* I can build with or without GNU */ strerror_r(nr, buf, len); /* I can build with or without GNU */
#elif defined _GNU_SOURCE #elif defined(__GLIBC__) && defined (_GNU_SOURCE)
char *r= strerror_r(nr, buf, len); char *r= strerror_r(nr, buf, len);
if (r != buf) /* Want to help, GNU? */ if (r != buf) /* Want to help, GNU? */
strmake(buf, r, len - 1); /* Then don't. */ strmake(buf, r, len - 1); /* Then don't. */
......
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