summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-06-26 19:58:43 +0300
committerMax Romanov <max.romanov@nginx.com>2017-06-26 19:58:43 +0300
commitb53b7b0413d4898b9bd73cd30e8d433b8893a66d (patch)
tree984fba281456d62f0803ab9b726a448ad7fba6d9 /src
parent9399a04121c054433ba3247523487d94ba9db2ba (diff)
downloadunit-b53b7b0413d4898b9bd73cd30e8d433b8893a66d.tar.gz
unit-b53b7b0413d4898b9bd73cd30e8d433b8893a66d.tar.bz2
Build on Solaris 11 fixed.
Diffstat (limited to 'src')
-rw-r--r--src/nginext/nxt_go_log.h3
-rw-r--r--src/nxt_clang.h3
-rw-r--r--src/nxt_conf_json.c2
-rw-r--r--src/nxt_conn.h2
-rw-r--r--src/nxt_mp.c37
-rw-r--r--src/nxt_unix.h2
6 files changed, 42 insertions, 7 deletions
diff --git a/src/nginext/nxt_go_log.h b/src/nginext/nxt_go_log.h
index f1291716..da1ce6a0 100644
--- a/src/nginext/nxt_go_log.h
+++ b/src/nginext/nxt_go_log.h
@@ -16,7 +16,8 @@
#if (NXT_DEBUG)
#define nxt_go_debug(fmt, ARGS...) \
- fprintf(stdout, "go debug[%p]: " fmt "\n", (void *) pthread_self(), ##ARGS)
+ fprintf(stdout, "go debug[%p]: " fmt "\n", \
+ (void *) (intptr_t) pthread_self(), ##ARGS)
#else
diff --git a/src/nxt_clang.h b/src/nxt_clang.h
index 82979c6a..09ccaf4c 100644
--- a/src/nxt_clang.h
+++ b/src/nxt_clang.h
@@ -210,9 +210,6 @@ nxt_bswap32(val) \
#define nxt_is_power_of_two(value) \
((((value) - 1) & (value)) == 0)
-#define nxt_lg2(value) \
- (31 - __builtin_clz(value))
-
#define \
nxt_align_size(d, a) \
diff --git a/src/nxt_conf_json.c b/src/nxt_conf_json.c
index 8117b679..2117b468 100644
--- a/src/nxt_conf_json.c
+++ b/src/nxt_conf_json.c
@@ -863,7 +863,7 @@ nxt_conf_json_object_hash_alloc(void *data, size_t size)
static void
nxt_conf_json_object_hash_free(void *data, void *p)
{
- return nxt_mp_free(data, p);
+ nxt_mp_free(data, p);
}
diff --git a/src/nxt_conn.h b/src/nxt_conn.h
index 6c4de090..f440e04b 100644
--- a/src/nxt_conn.h
+++ b/src/nxt_conn.h
@@ -108,7 +108,7 @@ typedef struct {
nxt_work_handler_t accept;
nxt_listen_socket_t *listen;
- nxt_conn_t *next; /* STUB */;
+ nxt_conn_t *next; /* STUB */
nxt_work_queue_t *work_queue;
nxt_timer_t timer;
diff --git a/src/nxt_mp.c b/src/nxt_mp.c
index 5a7308cd..f1ddd86b 100644
--- a/src/nxt_mp.c
+++ b/src/nxt_mp.c
@@ -113,7 +113,7 @@ struct nxt_mp_s {
nxt_queue_t free_pages;
nxt_queue_t nget_pages;
nxt_queue_t get_pages;
- nxt_queue_t chunk_pages[0];
+ nxt_queue_t chunk_pages[];
};
@@ -151,6 +151,41 @@ static const char *nxt_mp_chunk_free(nxt_mp_t *mp, nxt_mp_block_t *cluster,
u_char *p);
+#if (NXT_HAVE_BUILTIN_CLZ)
+
+#define nxt_lg2(value) \
+ (31 - __builtin_clz(value))
+
+#else
+
+static const int nxt_lg2_tab64[64] = {
+ 63, 0, 58, 1, 59, 47, 53, 2,
+ 60, 39, 48, 27, 54, 33, 42, 3,
+ 61, 51, 37, 40, 49, 18, 28, 20,
+ 55, 30, 34, 11, 43, 14, 22, 4,
+ 62, 57, 46, 52, 38, 26, 32, 41,
+ 50, 36, 17, 19, 29, 10, 13, 21,
+ 56, 45, 25, 31, 35, 16, 9, 12,
+ 44, 24, 15, 8, 23, 7, 6, 5
+};
+
+static const uint64_t nxt_lg2_magic = 0x07EDD5E59A4E28C2ULL;
+
+static int
+nxt_lg2(uint64_t v)
+{
+ v |= v >> 1;
+ v |= v >> 2;
+ v |= v >> 4;
+ v |= v >> 8;
+ v |= v >> 16;
+ v |= v >> 32;
+ return nxt_lg2_tab64[ ((v - (v >> 1)) * nxt_lg2_magic) >> 58 ];
+}
+
+#endif
+
+
nxt_mp_t *
nxt_mp_create(size_t cluster_size, size_t page_alignment, size_t page_size,
size_t min_chunk_size)
diff --git a/src/nxt_unix.h b/src/nxt_unix.h
index 8bcc8825..21096e31 100644
--- a/src/nxt_unix.h
+++ b/src/nxt_unix.h
@@ -63,7 +63,9 @@
#if (NXT_SOLARIS)
+#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64 /* Must be before <sys/types.h>. */
+#endif
#ifndef _REENTRANT /* May be set by "-mt" options. */
#define _REENTRANT /* Thread safe errno. */