From 8a303b196542aef1841f952c17f5612cc4e8ca47 Mon Sep 17 00:00:00 2001 From: "roberto@openindiana" Date: Tue, 6 Mar 2012 12:19:29 +0100 Subject: [PATCH] solaris fixes --- proto/sctp.c | 2 +- socket.c | 8 ++++++++ uwsgi.h | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/proto/sctp.c b/proto/sctp.c index 6b9793ae..5a4a835d 100644 --- a/proto/sctp.c +++ b/proto/sctp.c @@ -4,7 +4,7 @@ extern struct uwsgi_server uwsgi; -#ifdef __linux__ +#if defined(__linux__) || defined(__sun__) ssize_t sctp_sendv(int s, struct iovec *iov, size_t iov_len, const struct sctp_sndrcvinfo *sinfo, int flags) { diff --git a/socket.c b/socket.c index cf6815ca..1d8aa1e5 100644 --- a/socket.c +++ b/socket.c @@ -215,7 +215,15 @@ int connect_to_sctp(char *socket_names, int queue) { goto clear; } +// solaris has no sctp_connectx support +#ifdef __sun__ + if (addresses > 1) { + uwsgi_log("*** You will only connect to the first specified SCTP address !!! ***\n"); + } + if (connect(serverfd, (struct sockaddr *) sins, sizeof(struct sockaddr_in))) { +#else if (sctp_connectx(serverfd, (struct sockaddr *) sins, addresses, NULL)) { +#endif uwsgi_error("sctp_connectx()"); close(serverfd); goto clear; diff --git a/uwsgi.h b/uwsgi.h index 7f12a819..a31d8d81 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -184,6 +184,9 @@ extern int pivot_root(const char *new_root, const char *put_old); #ifdef UWSGI_SCTP #include +#ifndef SOL_SCTP +#define SOL_SCTP IPPROTO_SCTP +#endif #endif #ifndef UWSGI_PLUGIN_BASE