FS-6294 FS-6308 NetBSD support should work test and report back please.

This commit is contained in:
Brian West 2014-03-19 14:34:02 -05:00
parent b8f1a1779f
commit c4c0f38aab
8 changed files with 28 additions and 14 deletions

View File

@ -1375,6 +1375,9 @@ case $host in
*-solaris*) *-solaris*)
pid_t_fmt='#define APR_PID_T_FMT "ld"' pid_t_fmt='#define APR_PID_T_FMT "ld"'
;; ;;
*-netbsd*)
pid_t_fmt='#define APR_PID_T_FMT "ld"'
;;
*aix4*|*aix5*) *aix4*|*aix5*)
ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"' ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"'
size_t_fmt='#define APR_SIZE_T_FMT "ld"' size_t_fmt='#define APR_SIZE_T_FMT "ld"'

View File

@ -40,7 +40,7 @@ ESL_DECLARE(const char *)cJSON_GetErrorPtr(void) {return ep;}
static int cJSON_strcasecmp(const char *s1,const char *s2) static int cJSON_strcasecmp(const char *s1,const char *s2)
{ {
if (!s1) return (s1==s2)?0:1;if (!s2) return 1; if (!s1) return (s1==s2)?0:1;if (!s2) return 1;
for(; tolower(*s1) == tolower(*s2); ++s1, ++s2) if(*s1 == 0) return 0; for(; tolower(*(const unsigned char *)s1) == tolower(*(const unsigned char *)s2); ++s1, ++s2) if(*s1 == 0) return 0;
return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2); return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
} }

View File

@ -1 +1 @@
Tue Mar 18 17:42:45 CDT 2014 Wed Mar 19 14:23:50 CDT 2014

View File

@ -381,8 +381,8 @@ char const *append_escaped(su_strlst_t *l,
return NULL; return NULL;
for (;*n; n++) for (;*n; n++)
if (isupper(*n)) if (isupper(*(const unsigned char *)n))
*n = tolower(*n); *n = tolower(*(const unsigned char *)n);
slen = strlen(s); elen = url_esclen(s, HNV_RESERVED); slen = strlen(s); elen = url_esclen(s, HNV_RESERVED);

View File

@ -183,7 +183,7 @@ bm_memcasemem_study0(char const *needle, size_t nlen, bm_fwd_table_t *fwd)
fwd->table[i] = (unsigned char)nlen; fwd->table[i] = (unsigned char)nlen;
for (i = 0; i < nlen; i++) { for (i = 0; i < nlen; i++) {
unsigned char n = tolower(needle[i]); unsigned char n = tolower((const unsigned char)needle[i]);
fwd->table[n] = (unsigned char)(nlen - i - 1); fwd->table[n] = (unsigned char)(nlen - i - 1);
} }

View File

@ -46,6 +46,17 @@
#include <sys/event.h> #include <sys/event.h>
/* INT_TO_UDATA() macros from https://github.com/libevent/libevent */
/* Some platforms apparently define the udata field of struct kevent as
* intptr_t, whereas others define it as void*. There doesn't seem to be an
* easy way to tell them apart via autoconf, so we need to use OS macros. */
#if defined(HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__)
#define INT_TO_UDATA(x) ((intptr_t)(x))
#else
#define INT_TO_UDATA(x) ((void*)(intptr_t)(x))
#endif
#define SU_ENABLE_MULTISHOT_KQUEUE 1 #define SU_ENABLE_MULTISHOT_KQUEUE 1
#include <stdlib.h> #include <stdlib.h>
@ -246,7 +257,7 @@ int su_kqueue_port_register(su_port_t *self,
i = ser->ser_id; i = ser->ser_id;
flags = (wait->events & SU_WAIT_IN) ? EV_ADD : EV_ADD | EV_DISABLE; flags = (wait->events & SU_WAIT_IN) ? EV_ADD : EV_ADD | EV_DISABLE;
EV_SET(ev, wait->fd, EVFILT_READ, flags, 0, 0, (void *)(intptr_t)i); EV_SET(ev, wait->fd, EVFILT_READ, flags, 0, 0, INT_TO_UDATA(i));
if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) { if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) {
SU_DEBUG_0(("kevent((%u, %s, %u, %p)) failed: %s\n", SU_DEBUG_0(("kevent((%u, %s, %u, %p)) failed: %s\n",
wait->fd, "EVFILT_READ", flags, (void *)(intptr_t)i, strerror(errno))); wait->fd, "EVFILT_READ", flags, (void *)(intptr_t)i, strerror(errno)));
@ -254,13 +265,13 @@ int su_kqueue_port_register(su_port_t *self,
} }
flags = (wait->events & SU_WAIT_OUT) ? EV_ADD : EV_ADD | EV_DISABLE; flags = (wait->events & SU_WAIT_OUT) ? EV_ADD : EV_ADD | EV_DISABLE;
EV_SET(ev, wait->fd, EVFILT_WRITE, flags, 0, 0, (void *)(intptr_t)i); EV_SET(ev, wait->fd, EVFILT_WRITE, flags, 0, 0, INT_TO_UDATA(i));
if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) { if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) {
int error = errno; int error = errno;
SU_DEBUG_0(("kevent((%u, %s, %u, %p)) failed: %s\n", SU_DEBUG_0(("kevent((%u, %s, %u, %p)) failed: %s\n",
wait->fd, "EVFILT_WRITE", flags, (void *)(intptr_t)i, strerror(error))); wait->fd, "EVFILT_WRITE", flags, (void *)(intptr_t)i, strerror(error)));
EV_SET(ev, wait->fd, EVFILT_READ, EV_DELETE, 0, 0, (void *)(intptr_t)i); EV_SET(ev, wait->fd, EVFILT_READ, EV_DELETE, 0, 0, INT_TO_UDATA(i));
kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL); kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL);
errno = error; errno = error;
@ -298,14 +309,14 @@ static int su_kqueue_port_deregister0(su_port_t *self, int i, int destroy_wait)
wait = ser->ser_wait; wait = ser->ser_wait;
EV_SET(ev, wait->fd, EVFILT_READ, EV_DELETE, 0, 0, (void *)(intptr_t)i); EV_SET(ev, wait->fd, EVFILT_READ, EV_DELETE, 0, 0, INT_TO_UDATA(i));
if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) { if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) {
SU_DEBUG_0(("remove kevent((%u, %s, %s, %p)) failed: %s\n", SU_DEBUG_0(("remove kevent((%u, %s, %s, %p)) failed: %s\n",
wait->fd, "EVFILT_READ", "EV_DELETE", (void *)(intptr_t)i, wait->fd, "EVFILT_READ", "EV_DELETE", (void *)(intptr_t)i,
strerror(errno))); strerror(errno)));
} }
EV_SET(ev, wait->fd, EVFILT_WRITE, EV_DELETE, 0, 0, (void *)(intptr_t)i); EV_SET(ev, wait->fd, EVFILT_WRITE, EV_DELETE, 0, 0, INT_TO_UDATA(i));
if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) { if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) {
SU_DEBUG_0(("remove kevent((%u, %s, %s, %p)) failed: %s\n", SU_DEBUG_0(("remove kevent((%u, %s, %s, %p)) failed: %s\n",
wait->fd, "EVFILT_WRITE", "EV_DELETE", (void *)(intptr_t)i, wait->fd, "EVFILT_WRITE", "EV_DELETE", (void *)(intptr_t)i,
@ -465,7 +476,7 @@ int su_kqueue_port_eventmask(su_port_t *self, int index, int socket, int events)
wait->events = events; wait->events = events;
flags = (wait->events & SU_WAIT_IN) ? EV_ADD | EV_ENABLE : EV_ADD | EV_DISABLE; flags = (wait->events & SU_WAIT_IN) ? EV_ADD | EV_ENABLE : EV_ADD | EV_DISABLE;
EV_SET(ev, wait->fd, EVFILT_READ, flags, 0, 0, (void *)(intptr_t)index); EV_SET(ev, wait->fd, EVFILT_READ, flags, 0, 0, INT_TO_UDATA(index));
if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) { if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) {
SU_DEBUG_0(("modify kevent((%u, %s, %s, %p)) failed: %s\n", SU_DEBUG_0(("modify kevent((%u, %s, %s, %p)) failed: %s\n",
wait->fd, "EVFILT_READ", wait->fd, "EVFILT_READ",
@ -474,7 +485,7 @@ int su_kqueue_port_eventmask(su_port_t *self, int index, int socket, int events)
} }
flags = (wait->events & SU_WAIT_OUT) ? EV_ADD | EV_ENABLE : EV_ADD | EV_DISABLE; flags = (wait->events & SU_WAIT_OUT) ? EV_ADD | EV_ENABLE : EV_ADD | EV_DISABLE;
EV_SET(ev, wait->fd, EVFILT_WRITE, flags, 0, 0, (void *)(intptr_t)index); EV_SET(ev, wait->fd, EVFILT_WRITE, flags, 0, 0, INT_TO_UDATA(index));
if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) { if (kevent(self->sup_kqueue, ev, 1, NULL, 0, NULL) == -1) {
SU_DEBUG_0(("modify kevent((%u, %s, %s, %p)) failed: %s\n", SU_DEBUG_0(("modify kevent((%u, %s, %s, %p)) failed: %s\n",
wait->fd, "EVFILT_WRITE", wait->fd, "EVFILT_WRITE",

View File

@ -384,7 +384,7 @@ static inline int switch_dtmftoi(char *s)
switch_assert(s); switch_assert(s);
if (!(r = atoi(s))) { if (!(r = atoi(s))) {
int l = tolower(*s); int l = tolower((unsigned char)*s);
if (l > 96 && l < 101) { if (l > 96 && l < 101) {
r = l - 87; r = l - 87;
} }

View File

@ -40,7 +40,7 @@ SWITCH_DECLARE(const char *)cJSON_GetErrorPtr() {return ep;}
static int cJSON_strcasecmp(const char *s1,const char *s2) static int cJSON_strcasecmp(const char *s1,const char *s2)
{ {
if (!s1) return (s1==s2)?0:1;if (!s2) return 1; if (!s1) return (s1==s2)?0:1;if (!s2) return 1;
for(; tolower(*s1) == tolower(*s2); ++s1, ++s2) if(*s1 == 0) return 0; for(; tolower(*(const unsigned char *)s1) == tolower(*(const unsigned char *)s2); ++s1, ++s2) if(*s1 == 0) return 0;
return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2); return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
} }