Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Redis 2.6 for Windows

  • Loading branch information...
commit a2453d4c726341a2342f26971e466c54f0a63b33 1 parent a644b0d
@HenryRawas HenryRawas authored
Showing with 474 additions and 45,397 deletions.
  1. +27 −0 .gitignore
  2. +14 −4 deps/hiredis/async.c
  3. +65 −0 deps/hiredis/dict.c
  4. +10 −0 deps/hiredis/dict.h
  5. +94 −17 deps/hiredis/hiredis.c
  6. +20 −0 deps/hiredis/hiredis.h
  7. +218 −1 deps/hiredis/net.c
  8. +19 −19 deps/hiredis/sds.c
  9. +7 −2 deps/hiredis/sds.h
  10. +0 −25 deps/jemalloc/.gitignore
  11. +0 −27 deps/jemalloc/COPYING
  12. +0 −380 deps/jemalloc/ChangeLog
  13. +0 −278 deps/jemalloc/INSTALL
  14. +0 −323 deps/jemalloc/Makefile.in
  15. +0 −16 deps/jemalloc/README
  16. +0 −1  deps/jemalloc/VERSION
  17. +0 −17 deps/jemalloc/autogen.sh
  18. +0 −9 deps/jemalloc/bin/jemalloc.sh.in
  19. +0 −5,348 deps/jemalloc/bin/pprof
  20. +0 −1,530 deps/jemalloc/config.guess
  21. 0  deps/jemalloc/config.stamp.in
  22. +0 −1,773 deps/jemalloc/config.sub
  23. +0 −8,274 deps/jemalloc/configure
  24. +0 −1,289 deps/jemalloc/configure.ac
  25. +0 −4 deps/jemalloc/doc/html.xsl.in
  26. +0 −1,482 deps/jemalloc/doc/jemalloc.3
  27. +0 −1,414 deps/jemalloc/doc/jemalloc.html
  28. +0 −2,173 deps/jemalloc/doc/jemalloc.xml.in
  29. +0 −4 deps/jemalloc/doc/manpages.xsl.in
  30. +0 −7 deps/jemalloc/doc/stylesheet.xsl
  31. +0 −975 deps/jemalloc/include/jemalloc/internal/arena.h
  32. +0 −304 deps/jemalloc/include/jemalloc/internal/atomic.h
  33. +0 −26 deps/jemalloc/include/jemalloc/internal/base.h
  34. +0 −184 deps/jemalloc/include/jemalloc/internal/bitmap.h
  35. +0 −63 deps/jemalloc/include/jemalloc/internal/chunk.h
  36. +0 −38 deps/jemalloc/include/jemalloc/internal/chunk_dss.h
  37. +0 −22 deps/jemalloc/include/jemalloc/internal/chunk_mmap.h
  38. +0 −90 deps/jemalloc/include/jemalloc/internal/ckh.h
  39. +0 −117 deps/jemalloc/include/jemalloc/internal/ctl.h
  40. +0 −46 deps/jemalloc/include/jemalloc/internal/extent.h
  41. +0 −70 deps/jemalloc/include/jemalloc/internal/hash.h
  42. +0 −40 deps/jemalloc/include/jemalloc/internal/huge.h
  43. +0 −1,010 deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in
  44. +0 −115 deps/jemalloc/include/jemalloc/internal/mb.h
  45. +0 −99 deps/jemalloc/include/jemalloc/internal/mutex.h
  46. +0 −367 deps/jemalloc/include/jemalloc/internal/private_namespace.h
  47. +0 −60 deps/jemalloc/include/jemalloc/internal/prng.h
  48. +0 −581 deps/jemalloc/include/jemalloc/internal/prof.h
  49. +0 −83 deps/jemalloc/include/jemalloc/internal/ql.h
  50. +0 −67 deps/jemalloc/include/jemalloc/internal/qr.h
  51. +0 −24 deps/jemalloc/include/jemalloc/internal/quarantine.h
  52. +0 −973 deps/jemalloc/include/jemalloc/internal/rb.h
  53. +0 −164 deps/jemalloc/include/jemalloc/internal/rtree.h
  54. +0 −122 deps/jemalloc/include/jemalloc/internal/size_classes.sh
  55. +0 −173 deps/jemalloc/include/jemalloc/internal/stats.h
  56. +0 −440 deps/jemalloc/include/jemalloc/internal/tcache.h
  57. +0 −397 deps/jemalloc/include/jemalloc/internal/tsd.h
  58. +0 −160 deps/jemalloc/include/jemalloc/internal/util.h
  59. +0 −157 deps/jemalloc/include/jemalloc/jemalloc.h.in
  60. +0 −262 deps/jemalloc/include/jemalloc/jemalloc_defs.h.in
  61. +0 −313 deps/jemalloc/include/msvc_compat/inttypes.h
  62. +0 −16 deps/jemalloc/include/msvc_compat/stdbool.h
  63. +0 −247 deps/jemalloc/include/msvc_compat/stdint.h
  64. +0 −23 deps/jemalloc/include/msvc_compat/strings.h
  65. +0 −250 deps/jemalloc/install-sh
  66. +0 −2,376 deps/jemalloc/src/arena.c
  67. +0 −2  deps/jemalloc/src/atomic.c
  68. +0 −139 deps/jemalloc/src/base.c
  69. +0 −90 deps/jemalloc/src/bitmap.c
  70. +0 −381 deps/jemalloc/src/chunk.c
  71. +0 −197 deps/jemalloc/src/chunk_dss.c
  72. +0 −210 deps/jemalloc/src/chunk_mmap.c
  73. +0 −609 deps/jemalloc/src/ckh.c
  74. +0 −1,671 deps/jemalloc/src/ctl.c
  75. +0 −39 deps/jemalloc/src/extent.c
  76. +0 −2  deps/jemalloc/src/hash.c
  77. +0 −313 deps/jemalloc/src/huge.c
  78. +0 −1,836 deps/jemalloc/src/jemalloc.c
  79. +0 −2  deps/jemalloc/src/mb.c
  80. +0 −149 deps/jemalloc/src/mutex.c
  81. +0 −1,315 deps/jemalloc/src/prof.c
  82. +0 −210 deps/jemalloc/src/quarantine.c
  83. +0 −67 deps/jemalloc/src/rtree.c
  84. +0 −549 deps/jemalloc/src/stats.c
  85. +0 −474 deps/jemalloc/src/tcache.c
  86. +0 −107 deps/jemalloc/src/tsd.c
  87. +0 −641 deps/jemalloc/src/util.c
  88. +0 −258 deps/jemalloc/src/zone.c
  89. +0 −66 deps/jemalloc/test/ALLOCM_ARENA.c
  90. +0 −2  deps/jemalloc/test/ALLOCM_ARENA.exp
  91. +0 −119 deps/jemalloc/test/aligned_alloc.c
  92. +0 −25 deps/jemalloc/test/aligned_alloc.exp
  93. +0 −118 deps/jemalloc/test/allocated.c
  94. +0 −2  deps/jemalloc/test/allocated.exp
  95. +0 −194 deps/jemalloc/test/allocm.c
  96. +0 −25 deps/jemalloc/test/allocm.exp
  97. +0 −153 deps/jemalloc/test/bitmap.c
  98. +0 −2  deps/jemalloc/test/bitmap.exp
  99. +0 −53 deps/jemalloc/test/jemalloc_test.h.in
  100. +0 −60 deps/jemalloc/test/mremap.c
  101. +0 −2  deps/jemalloc/test/mremap.exp
  102. +0 −115 deps/jemalloc/test/posix_memalign.c
  103. +0 −25 deps/jemalloc/test/posix_memalign.exp
  104. +0 −127 deps/jemalloc/test/rallocm.c
  105. +0 −2  deps/jemalloc/test/rallocm.exp
  106. +0 −80 deps/jemalloc/test/thread_arena.c
  107. +0 −2  deps/jemalloc/test/thread_arena.exp
  108. +0 −91 deps/jemalloc/test/thread_tcache_enabled.c
  109. +0 −2  deps/jemalloc/test/thread_tcache_enabled.exp
Sorry, we could not display the entire diff because it was too big.
View
27 .gitignore
@@ -20,3 +20,30 @@ deps/lua/src/liblua.a
.make-*
.prerequisites
*.dSYM
+*.user
+*.exe
+*.sdf
+*.suo
+msvs/Debug/
+msvs/Release/
+msvs/RedisBenchmark/Debug/
+msvs/RedisBenchmark/Release/
+msvs/RedisBenchmark/x64/
+msvs/RedisCheckAof/Debug/
+msvs/RedisCheckAof/Release/
+msvs/RedisCheckAof/x64/
+msvs/RedisCheckDump/Debug/
+msvs/RedisCheckDump/Release/
+msvs/RedisCheckDump/x64/
+msvs/RedisCli/Debug/
+msvs/RedisCli/Release/
+msvs/RedisCli/x64/
+msvs/hiredis/Debug/
+msvs/hiredis/Release/
+msvs/hiredis/x64/
+msvs/lua/lua/Debug/
+msvs/lua/lua/Release/
+msvs/lua/lua/x64/
+msvs/x64/
+msvs/ipch
+msvs/RedisServer.opensdf
View
18 deps/hiredis/async.c
@@ -32,7 +32,9 @@
#include "fmacros.h"
#include <stdlib.h>
#include <string.h>
+#ifndef _WIN32
#include <strings.h>
+#endif
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -40,6 +42,9 @@
#include "net.h"
#include "dict.c"
#include "sds.h"
+#ifdef _WIN32
+ #include "../../src/win32fixes.h"
+#endif
#define _EL_ADD_READ(ctx) do { \
if ((ctx)->ev.addRead) (ctx)->ev.addRead((ctx)->ev.data); \
@@ -57,23 +62,28 @@
if ((ctx)->ev.cleanup) (ctx)->ev.cleanup((ctx)->ev.data); \
} while(0);
+#ifdef _WIN32
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
+#endif
+
/* Forward declaration of function in hiredis.c */
void __redisAppendCommand(redisContext *c, char *cmd, size_t len);
/* Functions managing dictionary of callbacks for pub/sub. */
static unsigned int callbackHash(const void *key) {
- return dictGenHashFunction((unsigned char*)key,sdslen((char*)key));
+ return dictGenHashFunction((unsigned char*)key,(int)sdslen((char*)key));
}
static void *callbackValDup(void *privdata, const void *src) {
- ((void) privdata);
redisCallback *dup = malloc(sizeof(*dup));
+ ((void) privdata);
memcpy(dup,src,sizeof(*dup));
return dup;
}
static int callbackKeyCompare(void *privdata, const void *key1, const void *key2) {
- int l1, l2;
+ size_t l1, l2;
((void) privdata);
l1 = sdslen((sds)key1);
@@ -442,7 +452,7 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
static int __redisAsyncHandleConnect(redisAsyncContext *ac) {
redisContext *c = &(ac->c);
- if (redisCheckSocketError(c,c->fd) == REDIS_ERR) {
+ if (redisCheckSocketError(c,(int)c->fd) == REDIS_ERR) {
/* Try again later when connect(2) is still in progress. */
if (errno == EINPROGRESS)
return REDIS_OK;
View
65 deps/hiredis/dict.c
@@ -42,7 +42,11 @@
/* -------------------------- private prototypes ---------------------------- */
static int _dictExpandIfNeeded(dict *ht);
+#ifdef _WIN32
+static size_t _dictNextPower(size_t size);
+#else
static unsigned long _dictNextPower(unsigned long size);
+#endif
static int _dictKeyIndex(dict *ht, const void *key);
static int _dictInit(dict *ht, dictType *type, void *privDataPtr);
@@ -85,6 +89,53 @@ static int _dictInit(dict *ht, dictType *type, void *privDataPtr) {
}
/* Expand or create the hashtable */
+#ifdef _WIN32
+static int dictExpand(dict *ht, size_t size) {
+ dict n; /* the new hashtable */
+ size_t realsize = _dictNextPower(size), i;
+
+ /* the size is invalid if it is smaller than the number of
+ * elements already inside the hashtable */
+ if (ht->used > size)
+ return DICT_ERR;
+
+ _dictInit(&n, ht->type, ht->privdata);
+ n.size = realsize;
+ n.sizemask = realsize-1;
+ n.table = calloc(realsize,sizeof(dictEntry*));
+
+ /* Copy all the elements from the old to the new table:
+ * note that if the old hash table is empty ht->size is zero,
+ * so dictExpand just creates an hash table. */
+ n.used = ht->used;
+ for (i = 0; i < ht->size && ht->used > 0; i++) {
+ dictEntry *he, *nextHe;
+
+ if (ht->table[i] == NULL) continue;
+
+ /* For each hash entry on this slot... */
+ he = ht->table[i];
+ while(he) {
+ unsigned int h;
+
+ nextHe = he->next;
+ /* Get the new element index */
+ h = dictHashKey(ht, he->key) & n.sizemask;
+ he->next = n.table[h];
+ n.table[h] = he;
+ ht->used--;
+ /* Pass to the next element */
+ he = nextHe;
+ }
+ }
+ assert(ht->used == 0);
+ free(ht->table);
+
+ /* Remap the new hashtable in the old */
+ *ht = n;
+ return DICT_OK;
+}
+#else
static int dictExpand(dict *ht, unsigned long size) {
dict n; /* the new hashtable */
unsigned long realsize = _dictNextPower(size), i;
@@ -130,6 +181,7 @@ static int dictExpand(dict *ht, unsigned long size) {
*ht = n;
return DICT_OK;
}
+#endif
/* Add an element to the target hash table */
static int dictAdd(dict *ht, void *key, void *val) {
@@ -303,6 +355,18 @@ static int _dictExpandIfNeeded(dict *ht) {
}
/* Our hash table capability is a power of two */
+#ifdef _WIN32
+static size_t _dictNextPower(size_t size) {
+ size_t i = DICT_HT_INITIAL_SIZE;
+
+ if (size >= LONG_MAX) return LONG_MAX;
+ while(1) {
+ if (i >= size)
+ return i;
+ i *= 2;
+ }
+}
+#else
static unsigned long _dictNextPower(unsigned long size) {
unsigned long i = DICT_HT_INITIAL_SIZE;
@@ -313,6 +377,7 @@ static unsigned long _dictNextPower(unsigned long size) {
i *= 2;
}
}
+#endif
/* Returns the index of a free slot that can be populated with
* an hash entry for the given 'key'.
View
10 deps/hiredis/dict.h
@@ -60,9 +60,15 @@ typedef struct dictType {
typedef struct dict {
dictEntry **table;
dictType *type;
+#ifdef _WIN32
+ size_t size;
+ size_t sizemask;
+ size_t used;
+#else
unsigned long size;
unsigned long sizemask;
unsigned long used;
+#endif
void *privdata;
} dict;
@@ -113,7 +119,11 @@ typedef struct dictIterator {
/* API */
static unsigned int dictGenHashFunction(const unsigned char *buf, int len);
static dict *dictCreate(dictType *type, void *privDataPtr);
+#ifdef _WIN32
+static int dictExpand(dict *ht, size_t size);
+#else
static int dictExpand(dict *ht, unsigned long size);
+#endif
static int dictAdd(dict *ht, void *key, void *val);
static int dictReplace(dict *ht, void *key, void *val);
static int dictDelete(dict *ht, const void *key);
View
111 deps/hiredis/hiredis.c
@@ -32,7 +32,9 @@
#include "fmacros.h"
#include <string.h>
#include <stdlib.h>
-#include <unistd.h>
+#ifndef _WIN32
+ #include <unistd.h>
+#endif
#include <assert.h>
#include <errno.h>
#include <ctype.h>
@@ -40,6 +42,9 @@
#include "hiredis.h"
#include "net.h"
#include "sds.h"
+#ifdef _WIN32
+ #include "../../src/win32fixes.h"
+#endif
static redisReply *createReplyObject(int type);
static void *createStringObject(const redisReadTask *task, char *str, size_t len);
@@ -116,7 +121,7 @@ static void *createStringObject(const redisReadTask *task, char *str, size_t len
memcpy(buf,str,len);
buf[len] = '\0';
r->str = buf;
- r->len = len;
+ r->len = (int)len;
if (task->parent) {
parent = task->parent->obj;
@@ -259,7 +264,7 @@ static char *readBytes(redisReader *r, unsigned int bytes) {
/* Find pointer to \r\n. */
static char *seekNewline(char *s, size_t len) {
int pos = 0;
- int _len = len-1;
+ int _len = (int)(len-1);
/* Position should be < len-1 because the character at "pos" should be
* followed by a \n. Note that strchr cannot be used because it doesn't
@@ -319,7 +324,7 @@ static char *readLine(redisReader *r, int *_len) {
p = r->buf+r->pos;
s = seekNewline(p,(r->len-r->pos));
if (s != NULL) {
- len = s-(r->buf+r->pos);
+ len = (int)(s-(r->buf+r->pos));
r->pos += len+2; /* skip \r\n */
if (_len) *_len = len;
return p;
@@ -390,7 +395,11 @@ static int processBulkItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
void *obj = NULL;
char *p, *s;
+#ifdef _WIN32
+ long long len;
+#else
long len;
+#endif
unsigned long bytelen;
int success = 0;
@@ -398,7 +407,7 @@ static int processBulkItem(redisReader *r) {
s = seekNewline(p,r->len-r->pos);
if (s != NULL) {
p = r->buf+r->pos;
- bytelen = s-(r->buf+r->pos)+2; /* include \r\n */
+ bytelen = (int)(s-(r->buf+r->pos)+2); /* include \r\n */
len = readLongLong(p);
if (len < 0) {
@@ -410,10 +419,10 @@ static int processBulkItem(redisReader *r) {
success = 1;
} else {
/* Only continue when the buffer contains the entire bulk item. */
- bytelen += len+2; /* include \r\n */
+ bytelen += (unsigned long)len+2; /* include \r\n */
if (r->pos+bytelen <= r->len) {
if (r->fn && r->fn->createString)
- obj = r->fn->createString(cur,s+2,len);
+ obj = r->fn->createString(cur,s+2,(size_t)len);
else
obj = (void*)REDIS_REPLY_STRING;
success = 1;
@@ -443,7 +452,11 @@ static int processMultiBulkItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
void *obj;
char *p;
+#ifdef _WIN32
+ long long elements;
+#else
long elements;
+#endif
int root = 0;
/* Set error for nested multi bulks with depth > 7 */
@@ -471,7 +484,7 @@ static int processMultiBulkItem(redisReader *r) {
moveToNextTask(r);
} else {
if (r->fn && r->fn->createArray)
- obj = r->fn->createArray(cur,elements);
+ obj = r->fn->createArray(cur,(int)elements);
else
obj = (void*)REDIS_REPLY_ARRAY;
@@ -482,7 +495,7 @@ static int processMultiBulkItem(redisReader *r) {
/* Modify task stack when there are more than 0 elements. */
if (elements > 0) {
- cur->elements = elements;
+ cur->elements = (int)elements;
cur->obj = obj;
r->ridx++;
r->rstack[r->ridx].type = -1;
@@ -650,7 +663,7 @@ int redisReaderGetReply(redisReader *r, void **reply) {
/* Discard part of the buffer when we've consumed at least 1k, to avoid
* doing unnecessary calls to memmove() in sds.c. */
if (r->pos >= 1024) {
- r->buf = sdsrange(r->buf,r->pos,-1);
+ r->buf = sdsrange(r->buf,(int)r->pos,-1);
r->pos = 0;
r->len = sdslen(r->buf);
}
@@ -680,7 +693,7 @@ static int intlen(int i) {
/* Helper that calculates the bulk length given a certain string length. */
static size_t bulklen(size_t len) {
- return 1+intlen(len)+2+len+2;
+ return (size_t)(1+intlen((int)len)+2+(int)len+2);
}
int redisvFormatCommand(char **target, const char *format, va_list ap) {
@@ -711,7 +724,7 @@ int redisvFormatCommand(char **target, const char *format, va_list ap) {
if (newargv == NULL) goto err;
curargv = newargv;
curargv[argc++] = curarg;
- totlen += bulklen(sdslen(curarg));
+ totlen += (int)bulklen(sdslen(curarg));
/* curarg is put in argv so it can be overwritten. */
curarg = sdsempty();
@@ -863,7 +876,7 @@ int redisvFormatCommand(char **target, const char *format, va_list ap) {
if (newargv == NULL) goto err;
curargv = newargv;
curargv[argc++] = curarg;
- totlen += bulklen(sdslen(curarg));
+ totlen += (int)bulklen(sdslen(curarg));
} else {
sdsfree(curarg);
}
@@ -875,14 +888,18 @@ int redisvFormatCommand(char **target, const char *format, va_list ap) {
totlen += 1+intlen(argc)+2;
/* Build the command at protocol level */
- cmd = malloc(totlen+1);
+ cmd = (char *)malloc(totlen+1);
if (cmd == NULL) goto err;
pos = sprintf(cmd,"*%d\r\n",argc);
for (j = 0; j < argc; j++) {
+#ifdef _WIN32
+ pos += sprintf(cmd+pos,"$%llu\r\n",(unsigned long long)sdslen(curargv[j]));
+#else
pos += sprintf(cmd+pos,"$%zu\r\n",sdslen(curargv[j]));
+#endif
memcpy(cmd+pos,curargv[j],sdslen(curargv[j]));
- pos += sdslen(curargv[j]);
+ pos += (int)sdslen(curargv[j]);
sdsfree(curargv[j]);
cmd[pos++] = '\r';
cmd[pos++] = '\n';
@@ -946,7 +963,7 @@ int redisFormatCommandArgv(char **target, int argc, const char **argv, const siz
totlen = 1+intlen(argc)+2;
for (j = 0; j < argc; j++) {
len = argvlen ? argvlen[j] : strlen(argv[j]);
- totlen += bulklen(len);
+ totlen += (int)bulklen(len);
}
/* Build the command at protocol level */
@@ -957,9 +974,13 @@ int redisFormatCommandArgv(char **target, int argc, const char **argv, const siz
pos = sprintf(cmd,"*%d\r\n",argc);
for (j = 0; j < argc; j++) {
len = argvlen ? argvlen[j] : strlen(argv[j]);
+#ifdef _WIN32
+ pos += sprintf(cmd+pos,"$%llu\r\n",(unsigned long long)len);
+#else
pos += sprintf(cmd+pos,"$%zu\r\n",len);
+#endif
memcpy(cmd+pos,argv[j],len);
- pos += len;
+ pos += (int)len;
cmd[pos++] = '\r';
cmd[pos++] = '\n';
}
@@ -1002,7 +1023,11 @@ static redisContext *redisContextInit(void) {
void redisFree(redisContext *c) {
if (c->fd > 0)
+#ifdef _WIN32
+ closesocket(c->fd);
+#else
close(c->fd);
+#endif
if (c->obuf != NULL)
sdsfree(c->obuf);
if (c->reader != NULL)
@@ -1055,6 +1080,21 @@ redisContext *redisConnectUnixNonBlock(const char *path) {
return c;
}
+/* initializers if caller handles connection */
+redisContext *redisConnected() {
+ redisContext *c = redisContextInit();
+ c->fd = -1;
+ c->flags |= REDIS_BLOCK;
+ return c;
+}
+
+redisContext *redisConnectedNonBlock() {
+ redisContext *c = redisContextInit();
+ c->fd = -1;
+ c->flags &= ~REDIS_BLOCK;
+ return c;
+}
+
/* Set read/write timeout on a blocking socket. */
int redisSetTimeout(redisContext *c, struct timeval tv) {
if (c->flags & REDIS_BLOCK)
@@ -1075,7 +1115,16 @@ int redisBufferRead(redisContext *c) {
if (c->err)
return REDIS_ERR;
+#ifdef _WIN32
+ nread = recv((SOCKET)c->fd,buf,sizeof(buf),0);
+ if (nread == -1) {
+ errno = WSAGetLastError();
+ if ((errno == ENOENT) || (errno == WSAEWOULDBLOCK))
+ errno = EAGAIN;
+ }
+#else
nread = read(c->fd,buf,sizeof(buf));
+#endif
if (nread == -1) {
if (errno == EAGAIN && !(c->flags & REDIS_BLOCK)) {
/* Try again later */
@@ -1095,6 +1144,25 @@ int redisBufferRead(redisContext *c) {
return REDIS_OK;
}
+
+/* Use this function if the caller has already read the data. It will
+ * feed bytes to the reply parser.
+ *
+ * After this function is called, you may use redisContextReadReply to
+ * see if there is a reply available. */
+int redisBufferReadDone(redisContext *c, char *buf, int nread) {
+ if (nread == 0) {
+ __redisSetError(c,REDIS_ERR_EOF, sdsnew("Server closed the connection"));
+ return REDIS_ERR;
+ } else {
+ if (redisReaderFeed(c->reader,buf,nread) != REDIS_OK) {
+ __redisSetError(c,c->reader->err,c->reader->errstr);
+ return REDIS_ERR;
+ }
+ }
+ return REDIS_OK;
+}
+
/* Write the output buffer to the socket.
*
* Returns REDIS_OK when the buffer is empty, or (a part of) the buffer was
@@ -1112,7 +1180,16 @@ int redisBufferWrite(redisContext *c, int *done) {
return REDIS_ERR;
if (sdslen(c->obuf) > 0) {
+#ifdef _WIN32
+ nwritten = send((SOCKET)c->fd,c->obuf,(int)sdslen(c->obuf),0);
+ if (nwritten == -1) {
+ errno = WSAGetLastError();
+ if ((errno == ENOENT) || (errno == WSAEWOULDBLOCK))
+ errno = EAGAIN;
+ }
+#else
nwritten = write(c->fd,c->obuf,sdslen(c->obuf));
+#endif
if (nwritten == -1) {
if (errno == EAGAIN && !(c->flags & REDIS_BLOCK)) {
/* Try again later */
View
20 deps/hiredis/hiredis.h
@@ -33,7 +33,20 @@
#define __HIREDIS_H
#include <stdio.h> /* for size_t */
#include <stdarg.h> /* for va_list */
+#ifndef _WIN32
#include <sys/time.h> /* for struct timeval */
+#endif
+#ifdef _WIN32
+ #ifndef FD_SETSIZE
+ #define FD_SETSIZE 16000
+ #endif
+ #include <winsock2.h>
+ #include <windows.h>
+
+ #ifndef va_copy
+ #define va_copy(d,s) d = (s)
+ #endif
+#endif
#define HIREDIS_MAJOR 0
#define HIREDIS_MINOR 10
@@ -164,7 +177,11 @@ int redisFormatCommandArgv(char **target, int argc, const char **argv, const siz
typedef struct redisContext {
int err; /* Error flags, 0 when there is no error */
char errstr[128]; /* String representation of error when applicable */
+#ifdef _WIN32
+ SOCKET fd;
+#else
int fd;
+#endif
int flags;
char *obuf; /* Write buffer */
redisReader *reader; /* Protocol reader */
@@ -176,10 +193,13 @@ redisContext *redisConnectNonBlock(const char *ip, int port);
redisContext *redisConnectUnix(const char *path);
redisContext *redisConnectUnixWithTimeout(const char *path, struct timeval tv);
redisContext *redisConnectUnixNonBlock(const char *path);
+redisContext *redisConnected();
+redisContext *redisConnectedNonBlock();
int redisSetTimeout(redisContext *c, struct timeval tv);
void redisFree(redisContext *c);
int redisBufferRead(redisContext *c);
int redisBufferWrite(redisContext *c, int *done);
+int redisBufferReadDone(redisContext *c, char *buf, int nread);
/* In a blocking context, this function first checks if there are unconsumed
* replies to return and returns one if so. Otherwise, it flushes the output
View
219 deps/hiredis/net.c
@@ -32,6 +32,11 @@
#include "fmacros.h"
#include <sys/types.h>
+#ifdef _WIN32
+ #ifndef FD_SETSIZE
+ #define FD_SETSIZE 16000
+ #endif
+#else
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/un.h>
@@ -39,17 +44,23 @@
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <unistd.h>
+#include <netdb.h>
+#endif
#include <fcntl.h>
#include <string.h>
-#include <netdb.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
+#ifndef _WIN32
#include <poll.h>
+#endif
#include <limits.h>
#include "net.h"
#include "sds.h"
+#ifdef _WIN32
+ #include "../../src/win32fixes.h"
+#endif
/* Defined in hiredis.c */
void __redisSetError(redisContext *c, int type, const char *str);
@@ -74,6 +85,31 @@ static int redisSetReuseAddr(redisContext *c, int fd) {
return REDIS_OK;
}
+#ifdef _WIN32
+static int redisCreateSocket(redisContext *c, int type) {
+ SOCKET s;
+ int on=1;
+
+ s = socket(type, SOCK_STREAM, IPPROTO_TCP);
+ if (s == INVALID_SOCKET) {
+ __redisSetError(c,REDIS_ERR_IO,sdscatprintf(sdsempty(), "socket error: %d\n", WSAGetLastError()));
+ return REDIS_ERR;
+ }
+ if (type == AF_INET) {
+ LINGER l;
+ l.l_onoff = 1;
+ l.l_linger = 2;
+ setsockopt((int)s, SOL_SOCKET, SO_LINGER, (const char *) &l, sizeof(l));
+
+ if (setsockopt((int)s, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(on)) == -1) {
+ __redisSetError(c,REDIS_ERR_IO,NULL);
+ closesocket(s);
+ return REDIS_ERR;
+ }
+ }
+ return (int)s;
+}
+#else
static int redisCreateSocket(redisContext *c, int type) {
int s;
if ((s = socket(type, SOCK_STREAM, 0)) == -1) {
@@ -87,7 +123,33 @@ static int redisCreateSocket(redisContext *c, int type) {
}
return s;
}
+}
+#endif
+
+
+#ifdef _WIN32
+static int redisSetBlocking(redisContext *c, int fd, int blocking) {
+ /* If iMode = 0, blocking is enabled; */
+ /* If iMode != 0, non-blocking mode is enabled. */
+ u_long flags;
+
+ if (blocking)
+ flags = (u_long)0;
+ else
+ flags = (u_long)1;
+
+ if (ioctlsocket((SOCKET)fd, FIONBIO, &flags) == SOCKET_ERROR) {
+ errno = WSAGetLastError();
+ __redisSetError(c,REDIS_ERR_IO,
+ sdscatprintf(sdsempty(), "ioctlsocket(FIONBIO): %d\n", errno));
+ closesocket(fd);
+ return REDIS_ERR;
+ };
+
+ return REDIS_OK;
+}
+#else
static int redisSetBlocking(redisContext *c, int fd, int blocking) {
int flags;
@@ -112,7 +174,20 @@ static int redisSetBlocking(redisContext *c, int fd, int blocking) {
}
return REDIS_OK;
}
+#endif
+#ifdef _WIN32
+static int redisSetTcpNoDelay(redisContext *c, int fd) {
+ int yes = 1;
+ if (setsockopt((SOCKET)fd, IPPROTO_TCP, TCP_NODELAY, (const char *)&yes, sizeof(yes)) == -1) {
+ __redisSetError(c,REDIS_ERR_IO,
+ sdscatprintf(sdsempty(), "setsockopt(TCP_NODELAY): %d", (int)GetLastError()));
+ closesocket(fd);
+ return REDIS_ERR;
+ }
+ return REDIS_OK;
+}
+#else
static int redisSetTcpNoDelay(redisContext *c, int fd) {
int yes = 1;
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes)) == -1) {
@@ -122,7 +197,48 @@ static int redisSetTcpNoDelay(redisContext *c, int fd) {
}
return REDIS_OK;
}
+#endif
+#ifdef _WIN32
+static int redisContextWaitReady(redisContext *c, int fd, const struct timeval *timeout) {
+ struct timeval to;
+ struct timeval *toptr = NULL;
+ fd_set wfd;
+
+ /* Only use timeout when not NULL. */
+ if (timeout != NULL) {
+ to = *timeout;
+ toptr = &to;
+ }
+
+ if (errno == EINPROGRESS) {
+ FD_ZERO(&wfd);
+ FD_SET((SOCKET)fd, &wfd);
+
+ if (select(FD_SETSIZE, NULL, &wfd, NULL, toptr) == -1) {
+ __redisSetErrorFromErrno(c,REDIS_ERR_IO,"select(2)");
+ closesocket(fd);
+ return REDIS_ERR;
+ }
+
+ if (!FD_ISSET(fd, &wfd)) {
+ errno = WSAGetLastError();
+ __redisSetErrorFromErrno(c,REDIS_ERR_IO,NULL);
+ closesocket(fd);
+ return REDIS_ERR;
+ }
+
+ if (redisCheckSocketError(c, fd) != REDIS_OK)
+ return REDIS_ERR;
+
+ return REDIS_OK;
+ }
+
+ __redisSetErrorFromErrno(c,REDIS_ERR_IO,NULL);
+ closesocket(fd);
+ return REDIS_ERR;
+}
+#else
#define __MAX_MSEC (((LONG_MAX) - 999) / 1000)
static int redisContextWaitReady(redisContext *c, int fd, const struct timeval *timeout) {
@@ -171,27 +287,58 @@ static int redisContextWaitReady(redisContext *c, int fd, const struct timeval *
close(fd);
return REDIS_ERR;
}
+#endif
int redisCheckSocketError(redisContext *c, int fd) {
int err = 0;
socklen_t errlen = sizeof(err);
+#ifdef _WIN32
+ if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char *)&err, &errlen) == SOCKET_ERROR) {
+ errno = WSAGetLastError();
+ __redisSetErrorFromErrno(c,REDIS_ERR_IO,"getsockopt(SO_ERROR)");
+ closesocket(fd);
+ return REDIS_ERR;
+ }
+#else
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,"getsockopt(SO_ERROR)");
close(fd);
return REDIS_ERR;
}
+#endif
if (err) {
errno = err;
__redisSetErrorFromErrno(c,REDIS_ERR_IO,NULL);
+#ifdef _WIN32
+ closesocket(fd);
+#else
close(fd);
+#endif
return REDIS_ERR;
}
return REDIS_OK;
}
+
+#ifdef _WIN32
+int redisContextSetTimeout(redisContext *c, struct timeval tv) {
+ DWORD ms = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
+ if (setsockopt((int)c->fd,SOL_SOCKET,SO_RCVTIMEO,(const char *)&ms,sizeof(ms)) == SOCKET_ERROR ) {
+ errno = WSAGetLastError();
+ __redisSetErrorFromErrno(c,REDIS_ERR_IO,"setsockopt(SO_RCVTIMEO)");
+ return REDIS_ERR;
+ }
+ if (setsockopt((int)c->fd,SOL_SOCKET,SO_SNDTIMEO,(const char *)&ms,sizeof(ms)) == SOCKET_ERROR ) {
+ errno = WSAGetLastError();
+ __redisSetErrorFromErrno(c,REDIS_ERR_IO,"setsockopt(SO_SNDTIMEO)");
+ return REDIS_ERR;
+ }
+ return REDIS_OK;
+}
+#else
int redisContextSetTimeout(redisContext *c, struct timeval tv) {
if (setsockopt(c->fd,SOL_SOCKET,SO_RCVTIMEO,&tv,sizeof(tv)) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,"setsockopt(SO_RCVTIMEO)");
@@ -203,7 +350,66 @@ int redisContextSetTimeout(redisContext *c, struct timeval tv) {
}
return REDIS_OK;
}
+#endif
+#ifdef _WIN32
+int redisContextConnectTcp(redisContext *c, const char *addr, int port, struct timeval *timeout) {
+ int s;
+ int blocking = (c->flags & REDIS_BLOCK);
+ struct sockaddr_in sa;
+ unsigned long inAddress;
+
+ if ((s = redisCreateSocket(c,AF_INET)) < 0)
+ return REDIS_ERR;
+
+ sa.sin_family = AF_INET;
+ sa.sin_port = htons(port);
+
+ inAddress = inet_addr(addr);
+ if (inAddress == INADDR_NONE || inAddress == INADDR_ANY) {
+ struct hostent *he;
+
+ he = gethostbyname(addr);
+ if (he == NULL) {
+ __redisSetError(c,REDIS_ERR_OTHER,
+ sdscatprintf(sdsempty(),"can't resolve: %s\n", addr));
+ closesocket(s);
+ return REDIS_ERR;
+ }
+ memcpy(&sa.sin_addr, he->h_addr, sizeof(struct in_addr));
+ }
+ else {
+ sa.sin_addr.s_addr = inAddress;
+ }
+
+ if (redisSetTcpNoDelay(c,s) != REDIS_OK)
+ return REDIS_ERR;
+
+ if (connect((SOCKET)s, (struct sockaddr*)&sa, sizeof(sa)) == -1) {
+ errno = WSAGetLastError();
+ if ((errno == WSAEINVAL) || (errno == WSAEWOULDBLOCK))
+ errno = EINPROGRESS;
+ if (errno == EINPROGRESS && !blocking) {
+ /* This is ok. */
+ } else {
+ if (redisContextWaitReady(c,s,timeout) != REDIS_OK)
+ return REDIS_ERR;
+ }
+ }
+
+ if (blocking) {
+ if (redisSetBlocking(c,s,1) != REDIS_OK)
+ return REDIS_ERR;
+ } else {
+ if (redisSetBlocking(c,s,0) != REDIS_OK)
+ return REDIS_ERR;
+ }
+
+ c->fd = s;
+ c->flags |= REDIS_CONNECTED;
+ return REDIS_OK;
+}
+#else
int redisContextConnectTcp(redisContext *c, const char *addr, int port, struct timeval *timeout) {
int s, rv;
char _port[6]; /* strlen("65535"); */
@@ -259,7 +465,17 @@ int redisContextConnectTcp(redisContext *c, const char *addr, int port, struct t
freeaddrinfo(servinfo);
return rv; // Need to return REDIS_OK if alright
}
+#endif
+
+#ifdef _WIN32
+int redisContextConnectUnix(redisContext *c, const char *path, struct timeval *timeout) {
+ (void) timeout;
+ __redisSetError(c,REDIS_ERR_IO,
+ sdscatprintf(sdsempty(),"Unix sockets are not suported on Windows platform. (%s)\n", path));
+ return REDIS_ERR;
+}
+#else
int redisContextConnectUnix(redisContext *c, const char *path, struct timeval *timeout) {
int s;
int blocking = (c->flags & REDIS_BLOCK);
@@ -289,3 +505,4 @@ int redisContextConnectUnix(redisContext *c, const char *path, struct timeval *t
c->flags |= REDIS_CONNECTED;
return REDIS_OK;
}
+#endif
View
38 deps/hiredis/sds.c
@@ -50,7 +50,7 @@ sds sdsnewlen(const void *init, size_t initlen) {
#else
if (sh == NULL) return NULL;
#endif
- sh->len = initlen;
+ sh->len = (int)initlen;
sh->free = 0;
if (initlen) {
if (init) memcpy(sh->buf, init, initlen);
@@ -80,7 +80,7 @@ void sdsfree(sds s) {
void sdsupdatelen(sds s) {
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
- int reallen = strlen(s);
+ int reallen = (int)strlen(s);
sh->free += (sh->len-reallen);
sh->len = reallen;
}
@@ -101,7 +101,7 @@ static sds sdsMakeRoomFor(sds s, size_t addlen) {
if (newsh == NULL) return NULL;
#endif
- newsh->free = newlen - len;
+ newsh->free = (int)(newlen - len);
return newsh->buf;
}
@@ -119,8 +119,8 @@ sds sdsgrowzero(sds s, size_t len) {
sh = (void*)(s-(sizeof(struct sdshdr)));
memset(s+curlen,0,(len-curlen+1)); /* also set trailing \0 byte */
totlen = sh->len+sh->free;
- sh->len = len;
- sh->free = totlen-sh->len;
+ sh->len = (int)len;
+ sh->free = (int)(totlen-sh->len);
return s;
}
@@ -132,8 +132,8 @@ sds sdscatlen(sds s, const void *t, size_t len) {
if (s == NULL) return NULL;
sh = (void*) (s-(sizeof(struct sdshdr)));
memcpy(s+curlen, t, len);
- sh->len = curlen+len;
- sh->free = sh->free-len;
+ sh->len = (int)(curlen+len);
+ sh->free = (int)(sh->free-len);
s[curlen+len] = '\0';
return s;
}
@@ -154,8 +154,8 @@ sds sdscpylen(sds s, char *t, size_t len) {
}
memcpy(s, t, len);
s[len] = '\0';
- sh->len = len;
- sh->free = totlen-len;
+ sh->len = (int)len;
+ sh->free = (int)(totlen-len);
return s;
}
@@ -211,8 +211,8 @@ sds sdstrim(sds s, const char *cset) {
len = (sp > ep) ? 0 : ((ep-sp)+1);
if (sh->buf != sp) memmove(sh->buf, sp, len);
sh->buf[len] = '\0';
- sh->free = sh->free+(sh->len-len);
- sh->len = len;
+ sh->free = (int)(sh->free+(sh->len-len));
+ sh->len = (int)len;
return s;
}
@@ -222,11 +222,11 @@ sds sdsrange(sds s, int start, int end) {
if (len == 0) return s;
if (start < 0) {
- start = len+start;
+ start = (int)(len+start);
if (start < 0) start = 0;
}
if (end < 0) {
- end = len+end;
+ end = (int)(len+end);
if (end < 0) end = 0;
}
newlen = (start > end) ? 0 : (end-start)+1;
@@ -234,7 +234,7 @@ sds sdsrange(sds s, int start, int end) {
if (start >= (signed)len) {
newlen = 0;
} else if (end >= (signed)len) {
- end = len-1;
+ end = (int)(len-1);
newlen = (start > end) ? 0 : (end-start)+1;
}
} else {
@@ -242,19 +242,19 @@ sds sdsrange(sds s, int start, int end) {
}
if (start && newlen) memmove(sh->buf, sh->buf+start, newlen);
sh->buf[newlen] = 0;
- sh->free = sh->free+(sh->len-newlen);
- sh->len = newlen;
+ sh->free = (int)(sh->free+(sh->len-newlen));
+ sh->len = (int)newlen;
return s;
}
void sdstolower(sds s) {
- int len = sdslen(s), j;
+ int len = (int)sdslen(s), j;
for (j = 0; j < len; j++) s[j] = tolower(s[j]);
}
void sdstoupper(sds s) {
- int len = sdslen(s), j;
+ int len = (int)sdslen(s), j;
for (j = 0; j < len; j++) s[j] = toupper(s[j]);
}
@@ -267,7 +267,7 @@ int sdscmp(sds s1, sds s2) {
l2 = sdslen(s2);
minlen = (l1 < l2) ? l1 : l2;
cmp = memcmp(s1,s2,minlen);
- if (cmp == 0) return l1-l2;
+ if (cmp == 0) return (int)(l1-l2);
return cmp;
}
View
9 deps/hiredis/sds.h
@@ -34,6 +34,11 @@
#include <sys/types.h>
#include <stdarg.h>
+#ifdef _WIN32
+ #define inline __inline
+ #define va_copy(d,s) d = (s)
+#endif
+
typedef char *sds;
struct sdshdr {
@@ -43,12 +48,12 @@ struct sdshdr {
};
static inline size_t sdslen(const sds s) {
- struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr)));
+ struct sdshdr *sh = (struct sdshdr *)(s-(sizeof(struct sdshdr)));
return sh->len;
}
static inline size_t sdsavail(const sds s) {
- struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr)));
+ struct sdshdr *sh = (struct sdshdr *)(s-(sizeof(struct sdshdr)));
return sh->free;
}
View
25 deps/jemalloc/.gitignore
@@ -1,25 +0,0 @@
-/autom4te.cache/
-/config.stamp
-/config.log
-/config.status
-/configure
-/doc/html.xsl
-/doc/manpages.xsl
-/doc/jemalloc.xml
-/doc/jemalloc.html
-/doc/jemalloc.3
-/lib/
-/Makefile
-/include/jemalloc/internal/jemalloc_internal\.h
-/include/jemalloc/internal/size_classes\.h
-/include/jemalloc/jemalloc\.h
-/include/jemalloc/jemalloc_defs\.h
-/test/jemalloc_test\.h
-/src/*.[od]
-/test/*.[od]
-/test/*.out
-/test/[a-zA-Z_]*
-!test/*.c
-!test/*.exp
-/VERSION
-/bin/jemalloc.sh
View
27 deps/jemalloc/COPYING
@@ -1,27 +0,0 @@
-Unless otherwise specified, files in the jemalloc source distribution are
-subject to the following license:
---------------------------------------------------------------------------------
-Copyright (C) 2002-2012 Jason Evans <jasone@canonware.com>.
-All rights reserved.
-Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
-Copyright (C) 2009-2012 Facebook, Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-1. Redistributions of source code must retain the above copyright notice(s),
- this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice(s),
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------------
View
380 deps/jemalloc/ChangeLog
@@ -1,380 +0,0 @@
-Following are change highlights associated with official releases. Important
-bug fixes are all mentioned, but internal enhancements are omitted here for
-brevity (even though they are more fun to write about). Much more detail can be
-found in the git revision history:
-
- http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git
- git://canonware.com/jemalloc.git
-
-* 3.2.0 (November 9, 2012)
-
- In addition to a couple of bug fixes, this version modifies page run
- allocation and dirty page purging algorithms in order to better control
- page-level virtual memory fragmentation.
-
- Incompatible changes:
- - Change the "opt.lg_dirty_mult" default from 5 to 3 (32:1 to 8:1).
-
- Bug fixes:
- - Fix dss/mmap allocation precedence code to use recyclable mmap memory only
- after primary dss allocation fails.
- - Fix deadlock in the "arenas.purge" mallctl. This regression was introduced
- in 3.1.0 by the addition of the "arena.<i>.purge" mallctl.
-
-* 3.1.0 (October 16, 2012)
-
- New features:
- - Auto-detect whether running inside Valgrind, thus removing the need to
- manually specify MALLOC_CONF=valgrind:true.
- - Add the "arenas.extend" mallctl, which allows applications to create
- manually managed arenas.
- - Add the ALLOCM_ARENA() flag for {,r,d}allocm().
- - Add the "opt.dss", "arena.<i>.dss", and "stats.arenas.<i>.dss" mallctls,
- which provide control over dss/mmap precedence.
- - Add the "arena.<i>.purge" mallctl, which obsoletes "arenas.purge".
- - Define LG_QUANTUM for hppa.
-
- Incompatible changes:
- - Disable tcache by default if running inside Valgrind, in order to avoid
- making unallocated objects appear reachable to Valgrind.
- - Drop const from malloc_usable_size() argument on Linux.
-
- Bug fixes:
- - Fix heap profiling crash if sampled object is freed via realloc(p, 0).
- - Remove const from __*_hook variable declarations, so that glibc can modify
- them during process forking.
- - Fix mlockall(2)/madvise(2) interaction.
- - Fix fork(2)-related deadlocks.
- - Fix error return value for "thread.tcache.enabled" mallctl.
-
-* 3.0.0 (May 11, 2012)
-
- Although this version adds some major new features, the primary focus is on
- internal code cleanup that facilitates maintainability and portability, most
- of which is not reflected in the ChangeLog. This is the first release to
- incorporate substantial contributions from numerous other developers, and the
- result is a more broadly useful allocator (see the git revision history for
- contribution details). Note that the license has been unified, thanks to
- Facebook granting a license under the same terms as the other copyright
- holders (see COPYING).
-
- New features:
- - Implement Valgrind support, redzones, and quarantine.
- - Add support for additional platforms:
- + FreeBSD
- + Mac OS X Lion
- + MinGW
- + Windows (no support yet for replacing the system malloc)
- - Add support for additional architectures:
- + MIPS
- + SH4
- + Tilera
- - Add support for cross compiling.
- - Add nallocm(), which rounds a request size up to the nearest size class
- without actually allocating.
- - Implement aligned_alloc() (blame C11).
- - Add the "thread.tcache.enabled" mallctl.
- - Add the "opt.prof_final" mallctl.
- - Update pprof (from gperftools 2.0).
- - Add the --with-mangling option.
- - Add the --disable-experimental option.
- - Add the --disable-munmap option, and make it the default on Linux.
- - Add the --enable-mremap option, which disables use of mremap(2) by default.
-
- Incompatible changes:
- - Enable stats by default.
- - Enable fill by default.
- - Disable lazy locking by default.
- - Rename the "tcache.flush" mallctl to "thread.tcache.flush".
- - Rename the "arenas.pagesize" mallctl to "arenas.page".
- - Change the "opt.lg_prof_sample" default from 0 to 19 (1 B to 512 KiB).
- - Change the "opt.prof_accum" default from true to false.
-
- Removed features:
- - Remove the swap feature, including the "config.swap", "swap.avail",
- "swap.prezeroed", "swap.nfds", and "swap.fds" mallctls.
- - Remove highruns statistics, including the
- "stats.arenas.<i>.bins.<j>.highruns" and
- "stats.arenas.<i>.lruns.<j>.highruns" mallctls.
- - As part of small size class refactoring, remove the "opt.lg_[qc]space_max",
- "arenas.cacheline", "arenas.subpage", "arenas.[tqcs]space_{min,max}", and
- "arenas.[tqcs]bins" mallctls.
- - Remove the "arenas.chunksize" mallctl.
- - Remove the "opt.lg_prof_tcmax" option.
- - Remove the "opt.lg_prof_bt_max" option.
- - Remove the "opt.lg_tcache_gc_sweep" option.
- - Remove the --disable-tiny option, including the "config.tiny" mallctl.
- - Remove the --enable-dynamic-page-shift configure option.
- - Remove the --enable-sysv configure option.
-
- Bug fixes:
- - Fix a statistics-related bug in the "thread.arena" mallctl that could cause
- invalid statistics and crashes.
- - Work around TLS deallocation via free() on Linux. This bug could cause
- write-after-free memory corruption.
- - Fix a potential deadlock that could occur during interval- and
- growth-triggered heap profile dumps.
- - Fix large calloc() zeroing bugs due to dropping chunk map unzeroed flags.
- - Fix chunk_alloc_dss() to stop claiming memory is zeroed. This bug could
- cause memory corruption and crashes with --enable-dss specified.
- - Fix fork-related bugs that could cause deadlock in children between fork
- and exec.
- - Fix malloc_stats_print() to honor 'b' and 'l' in the opts parameter.
- - Fix realloc(p, 0) to act like free(p).
- - Do not enforce minimum alignment in memalign().
- - Check for NULL pointer in malloc_usable_size().
- - Fix an off-by-one heap profile statistics bug that could be observed in
- interval- and growth-triggered heap profiles.
- - Fix the "epoch" mallctl to update cached stats even if the passed in epoch
- is 0.
- - Fix bin->runcur management to fix a layout policy bug. This bug did not
- affect correctness.
- - Fix a bug in choose_arena_hard() that potentially caused more arenas to be
- initialized than necessary.
- - Add missing "opt.lg_tcache_max" mallctl implementation.
- - Use glibc allocator hooks to make mixed allocator usage less likely.
- - Fix build issues for --disable-tcache.
- - Don't mangle pthread_create() when --with-private-namespace is specified.
-
-* 2.2.5 (November 14, 2011)
-
- Bug fixes:
- - Fix huge_ralloc() race when using mremap(2). This is a serious bug that
- could cause memory corruption and/or crashes.
- - Fix huge_ralloc() to maintain chunk statistics.
- - Fix malloc_stats_print(..., "a") output.
-
-* 2.2.4 (November 5, 2011)
-
- Bug fixes:
- - Initialize arenas_tsd before using it. This bug existed for 2.2.[0-3], as
- well as for --disable-tls builds in earlier releases.
- - Do not assume a 4 KiB page size in test/rallocm.c.
-
-* 2.2.3 (August 31, 2011)
-
- This version fixes numerous bugs related to heap profiling.
-
- Bug fixes:
- - Fix a prof-related race condition. This bug could cause memory corruption,
- but only occurred in non-default configurations (prof_accum:false).
- - Fix off-by-one backtracing issues (make sure that prof_alloc_prep() is
- excluded from backtraces).
- - Fix a prof-related bug in realloc() (only triggered by OOM errors).
- - Fix prof-related bugs in allocm() and rallocm().
- - Fix prof_tdata_cleanup() for --disable-tls builds.
- - Fix a relative include path, to fix objdir builds.
-
-* 2.2.2 (July 30, 2011)
-
- Bug fixes:
- - Fix a build error for --disable-tcache.
- - Fix assertions in arena_purge() (for real this time).
- - Add the --with-private-namespace option. This is a workaround for symbol
- conflicts that can inadvertently arise when using static libraries.
-
-* 2.2.1 (March 30, 2011)
-
- Bug fixes:
- - Implement atomic operations for x86/x64. This fixes compilation failures
- for versions of gcc that are still in wide use.
- - Fix an assertion in arena_purge().
-
-* 2.2.0 (March 22, 2011)
-
- This version incorporates several improvements to algorithms and data
- structures that tend to reduce fragmentation and increase speed.
-
- New features:
- - Add the "stats.cactive" mallctl.
- - Update pprof (from google-perftools 1.7).
- - Improve backtracing-related configuration logic, and add the
- --disable-prof-libgcc option.
-
- Bug fixes:
- - Change default symbol visibility from "internal", to "hidden", which
- decreases the overhead of library-internal function calls.
- - Fix symbol visibility so that it is also set on OS X.
- - Fix a build dependency regression caused by the introduction of the .pic.o
- suffix for PIC object files.
- - Add missing checks for mutex initialization failures.
- - Don't use libgcc-based backtracing except on x64, where it is known to work.
- - Fix deadlocks on OS X that were due to memory allocation in
- pthread_mutex_lock().
- - Heap profiling-specific fixes:
- + Fix memory corruption due to integer overflow in small region index
- computation, when using a small enough sample interval that profiling
- context pointers are stored in small run headers.
- + Fix a bootstrap ordering bug that only occurred with TLS disabled.
- + Fix a rallocm() rsize bug.
- + Fix error detection bugs for aligned memory allocation.
-
-* 2.1.3 (March 14, 2011)
-
- Bug fixes:
- - Fix a cpp logic regression (due to the "thread.{de,}allocatedp" mallctl fix
- for OS X in 2.1.2).
- - Fix a "thread.arena" mallctl bug.
- - Fix a thread cache stats merging bug.
-
-* 2.1.2 (March 2, 2011)
-
- Bug fixes:
- - Fix "thread.{de,}allocatedp" mallctl for OS X.
- - Add missing jemalloc.a to build system.
-
-* 2.1.1 (January 31, 2011)
-
- Bug fixes:
- - Fix aligned huge reallocation (affected allocm()).
- - Fix the ALLOCM_LG_ALIGN macro definition.
- - Fix a heap dumping deadlock.
- - Fix a "thread.arena" mallctl bug.
-
-* 2.1.0 (December 3, 2010)
-
- This version incorporates some optimizations that can't quite be considered
- bug fixes.
-
- New features:
- - Use Linux's mremap(2) for huge object reallocation when possible.
- - Avoid locking in mallctl*() when possible.
- - Add the "thread.[de]allocatedp" mallctl's.
- - Convert the manual page source from roff to DocBook, and generate both roff
- and HTML manuals.
-
- Bug fixes:
- - Fix a crash due to incorrect bootstrap ordering. This only impacted
- --enable-debug --enable-dss configurations.
- - Fix a minor statistics bug for mallctl("swap.avail", ...).
-
-* 2.0.1 (October 29, 2010)
-
- Bug fixes:
- - Fix a race condition in heap profiling that could cause undefined behavior
- if "opt.prof_accum" were disabled.
- - Add missing mutex unlocks for some OOM error paths in the heap profiling
- code.
- - Fix a compilation error for non-C99 builds.
-
-* 2.0.0 (October 24, 2010)
-
- This version focuses on the experimental *allocm() API, and on improved
- run-time configuration/introspection. Nonetheless, numerous performance
- improvements are also included.
-
- New features:
- - Implement the experimental {,r,s,d}allocm() API, which provides a superset
- of the functionality available via malloc(), calloc(), posix_memalign(),
- realloc(), malloc_usable_size(), and free(). These functions can be used to
- allocate/reallocate aligned zeroed memory, ask for optional extra memory
- during reallocation, prevent object movement during reallocation, etc.
- - Replace JEMALLOC_OPTIONS/JEMALLOC_PROF_PREFIX with MALLOC_CONF, which is
- more human-readable, and more flexible. For example:
- JEMALLOC_OPTIONS=AJP
- is now:
- MALLOC_CONF=abort:true,fill:true,stats_print:true
- - Port to Apple OS X. Sponsored by Mozilla.
- - Make it possible for the application to control thread-->arena mappings via
- the "thread.arena" mallctl.
- - Add compile-time support for all TLS-related functionality via pthreads TSD.
- This is mainly of interest for OS X, which does not support TLS, but has a
- TSD implementation with similar performance.
- - Override memalign() and valloc() if they are provided by the system.
- - Add the "arenas.purge" mallctl, which can be used to synchronously purge all
- dirty unused pages.
- - Make cumulative heap profiling data optional, so that it is possible to
- limit the amount of memory consumed by heap profiling data structures.
- - Add per thread allocation counters that can be accessed via the
- "thread.allocated" and "thread.deallocated" mallctls.
-
- Incompatible changes:
- - Remove JEMALLOC_OPTIONS and malloc_options (see MALLOC_CONF above).
- - Increase default backtrace depth from 4 to 128 for heap profiling.
- - Disable interval-based profile dumps by default.
-
- Bug fixes:
- - Remove bad assertions in fork handler functions. These assertions could
- cause aborts for some combinations of configure settings.
- - Fix strerror_r() usage to deal with non-standard semantics in GNU libc.
- - Fix leak context reporting. This bug tended to cause the number of contexts
- to be underreported (though the reported number of objects and bytes were
- correct).
- - Fix a realloc() bug for large in-place growing reallocation. This bug could
- cause memory corruption, but it was hard to trigger.
- - Fix an allocation bug for small allocations that could be triggered if
- multiple threads raced to create a new run of backing pages.
- - Enhance the heap profiler to trigger samples based on usable size, rather
- than request size.
- - Fix a heap profiling bug due to sometimes losing track of requested object
- size for sampled objects.
-
-* 1.0.3 (August 12, 2010)
-
- Bug fixes:
- - Fix the libunwind-based implementation of stack backtracing (used for heap
- profiling). This bug could cause zero-length backtraces to be reported.
- - Add a missing mutex unlock in library initialization code. If multiple
- threads raced to initialize malloc, some of them could end up permanently
- blocked.
-
-* 1.0.2 (May 11, 2010)
-
- Bug fixes:
- - Fix junk filling of large objects, which could cause memory corruption.
- - Add MAP_NORESERVE support for chunk mapping, because otherwise virtual
- memory limits could cause swap file configuration to fail. Contributed by
- Jordan DeLong.
-
-* 1.0.1 (April 14, 2010)
-
- Bug fixes:
- - Fix compilation when --enable-fill is specified.
- - Fix threads-related profiling bugs that affected accuracy and caused memory
- to be leaked during thread exit.
- - Fix dirty page purging race conditions that could cause crashes.
- - Fix crash in tcache flushing code during thread destruction.
-
-* 1.0.0 (April 11, 2010)
-
- This release focuses on speed and run-time introspection. Numerous
- algorithmic improvements make this release substantially faster than its
- predecessors.
-
- New features:
- - Implement autoconf-based configuration system.
- - Add mallctl*(), for the purposes of introspection and run-time
- configuration.
- - Make it possible for the application to manually flush a thread's cache, via
- the "tcache.flush" mallctl.
- - Base maximum dirty page count on proportion of active memory.
- - Compute various addtional run-time statistics, including per size class
- statistics for large objects.
- - Expose malloc_stats_print(), which can be called repeatedly by the
- application.
- - Simplify the malloc_message() signature to only take one string argument,
- and incorporate an opaque data pointer argument for use by the application
- in combination with malloc_stats_print().
- - Add support for allocation backed by one or more swap files, and allow the
- application to disable over-commit if swap files are in use.
- - Implement allocation profiling and leak checking.
-
- Removed features:
- - Remove the dynamic arena rebalancing code, since thread-specific caching
- reduces its utility.
-
- Bug fixes:
- - Modify chunk allocation to work when address space layout randomization
- (ASLR) is in use.
- - Fix thread cleanup bugs related to TLS destruction.
- - Handle 0-size allocation requests in posix_memalign().
- - Fix a chunk leak. The leaked chunks were never touched, so this impacted
- virtual memory usage, but not physical memory usage.
-
-* linux_2008082[78]a (August 27/28, 2008)
-
- These snapshot releases are the simple result of incorporating Linux-specific
- support into the FreeBSD malloc sources.
-
---------------------------------------------------------------------------------
-vim:filetype=text:textwidth=80
View
278 deps/jemalloc/INSTALL
@@ -1,278 +0,0 @@
-Building and installing jemalloc can be as simple as typing the following while
-in the root directory of the source tree:
-
- ./configure
- make
- make install
-
-=== Advanced configuration =====================================================
-
-The 'configure' script supports numerous options that allow control of which
-functionality is enabled, where jemalloc is installed, etc. Optionally, pass
-any of the following arguments (not a definitive list) to 'configure':
-
---help
- Print a definitive list of options.
-
---prefix=<install-root-dir>
- Set the base directory in which to install. For example:
-
- ./configure --prefix=/usr/local
-
- will cause files to be installed into /usr/local/include, /usr/local/lib,
- and /usr/local/man.
-
---with-rpath=<colon-separated-rpath>
- Embed one or more library paths, so that libjemalloc can find the libraries
- it is linked to. This works only on ELF-based systems.
-
---with-mangling=<map>
- Mangle public symbols specified in <map> which is a comma-separated list of
- name:mangled pairs.
-
- For example, to use ld's --wrap option as an alternative method for
- overriding libc's malloc implementation, specify something like:
-
- --with-mangling=malloc:__wrap_malloc,free:__wrap_free[...]
-
- Note that mangling happens prior to application of the prefix specified by
- --with-jemalloc-prefix, and mangled symbols are then ignored when applying
- the prefix.
-
---with-jemalloc-prefix=<prefix>
- Prefix all public APIs with <prefix>. For example, if <prefix> is
- "prefix_", API changes like the following occur:
-
- malloc() --> prefix_malloc()
- malloc_conf --> prefix_malloc_conf
- /etc/malloc.conf --> /etc/prefix_malloc.conf
- MALLOC_CONF --> PREFIX_MALLOC_CONF
-
- This makes it possible to use jemalloc at the same time as the system
- allocator, or even to use multiple copies of jemalloc simultaneously.
-
- By default, the prefix is "", except on OS X, where it is "je_". On OS X,
- jemalloc overlays the default malloc zone, but makes no attempt to actually
- replace the "malloc", "calloc", etc. symbols.
-
---with-private-namespace=<prefix>
- Prefix all library-private APIs with <prefix>. For shared libraries,
- symbol visibility mechanisms prevent these symbols from being exported, but
- for static libraries, naming collisions are a real possibility. By
- default, the prefix is "" (empty string).
-
---with-install-suffix=<suffix>
- Append <suffix> to the base name of all installed files, such that multiple
- versions of jemalloc can coexist in the same installation directory. For
- example, libjemalloc.so.0 becomes libjemalloc<suffix>.so.0.
-
---enable-cc-silence
- Enable code that silences non-useful compiler warnings. This is helpful
- when trying to tell serious warnings from those due to compiler
- limitations, but it potentially incurs a performance penalty.
-
---enable-debug
- Enable assertions and validation code. This incurs a substantial
- performance hit, but is very useful during application development.
-
---disable-stats
- Disable statistics gathering functionality. See the "opt.stats_print"
- option documentation for usage details.
-
---enable-prof
- Enable heap profiling and leak detection functionality. See the "opt.prof"
- option documentation for usage details. When enabled, there are several
- approaches to backtracing, and the configure script chooses the first one
- in the following list that appears to function correctly:
-
- + libunwind (requires --enable-prof-libunwind)
- + libgcc (unless --disable-prof-libgcc)
- + gcc intrinsics (unless --disable-prof-gcc)
-
---enable-prof-libunwind
- Use the libunwind library (http://www.nongnu.org/libunwind/) for stack
- backtracing.
-
---disable-prof-libgcc
- Disable the use of libgcc's backtracing functionality.
-
---disable-prof-gcc
- Disable the use of gcc intrinsics for backtracing.
-
---with-static-libunwind=<libunwind.a>
- Statically link against the specified libunwind.a rather than dynamically
- linking with -lunwind.
-
---disable-tcache
- Disable thread-specific caches for small objects. Objects are cached and
- released in bulk, thus reducing the total number of mutex operations. See
- the "opt.tcache" option for usage details.
-
---enable-mremap
- Enable huge realloc() via mremap(2). mremap() is disabled by default
- because the flavor used is specific to Linux, which has a quirk in its
- virtual memory allocation algorithm that causes semi-permanent VM map holes
- under normal jemalloc operation.
-
---disable-munmap
- Disable virtual memory deallocation via munmap(2); instead keep track of
- the virtual memory for later use. munmap() is disabled by default (i.e.
- --disable-munmap is implied) on Linux, which has a quirk in its virtual
- memory allocation algorithm that causes semi-permanent VM map holes under
- normal jemalloc operation.
-
---enable-dss
- Enable support for page allocation/deallocation via sbrk(2), in addition to
- mmap(2).
-
---disable-fill
- Disable support for junk/zero filling of memory, quarantine, and redzones.
- See the "opt.junk", "opt.zero", "opt.quarantine", and "opt.redzone" option
- documentation for usage details.
-
---disable-valgrind
- Disable support for Valgrind.
-
---disable-experimental
- Disable support for the experimental API (*allocm()).
-
---enable-utrace
- Enable utrace(2)-based allocation tracing. This feature is not broadly
- portable (FreeBSD has it, but Linux and OS X do not).
-
---enable-xmalloc
- Enable support for optional immediate termination due to out-of-memory
- errors, as is commonly implemented by "xmalloc" wrapper function for malloc.
- See the "opt.xmalloc" option documentation for usage details.
-
---enable-lazy-lock
- Enable code that wraps pthread_create() to detect when an application
- switches from single-threaded to multi-threaded mode, so that it can avoid
- mutex locking/unlocking operations while in single-threaded mode. In
- practice, this feature usually has little impact on performance unless
- thread-specific caching is disabled.
-
---disable-tls
- Disable thread-local storage (TLS), which allows for fast access to
- thread-local variables via the __thread keyword. If TLS is available,
- jemalloc uses it for several purposes.
-
---with-xslroot=<path>
- Specify where to find DocBook XSL stylesheets when building the
- documentation.
-
-The following environment variables (not a definitive list) impact configure's
-behavior:
-
-CFLAGS="?"
- Pass these flags to the compiler. You probably shouldn't define this unless
- you know what you are doing. (Use EXTRA_CFLAGS instead.)
-
-EXTRA_CFLAGS="?"
- Append these flags to CFLAGS. This makes it possible to add flags such as
- -Werror, while allowing the configure script to determine what other flags
- are appropriate for the specified configuration.
-
- The configure script specifically checks whether an optimization flag (-O*)
- is specified in EXTRA_CFLAGS, and refrains from specifying an optimization
- level if it finds that one has already been specified.
-
-CPPFLAGS="?"
- Pass these flags to the C preprocessor. Note that CFLAGS is not passed to
- 'cpp' when 'configure' is looking for include files, so you must use
- CPPFLAGS instead if you need to help 'configure' find header files.
-
-LD_LIBRARY_PATH="?"
- 'ld' uses this colon-separated list to find libraries.
-
-LDFLAGS="?"
- Pass these flags when linking.
-
-PATH="?"
- 'configure' uses this to find programs.
-
-=== Advanced compilation =======================================================
-
-To build only parts of jemalloc, use the following targets:
-
- build_lib_shared
- build_lib_static
- build_lib
- build_doc_html
- build_doc_man
- build_doc
-
-To install only parts of jemalloc, use the following targets:
-
- install_bin
- install_include
- install_lib_shared
- install_lib_static
- install_lib
- install_doc_html
- install_doc_man
- install_doc
-
-To clean up build results to varying degrees, use the following make targets:
-
- clean
- distclean
- relclean
-
-=== Advanced installation ======================================================
-
-Optionally, define make variables when invoking make, including (not
-exclusively):
-
-INCLUDEDIR="?"
- Use this as the installation prefix for header files.
-
-LIBDIR="?"
- Use this as the installation prefix for libraries.
-
-MANDIR="?"
- Use this as the installation prefix for man pages.
-
-DESTDIR="?"
- Prepend DESTDIR to INCLUDEDIR, LIBDIR, DATADIR, and MANDIR. This is useful
- when installing to a different path than was specified via --prefix.
-
-CC="?"
- Use this to invoke the C compiler.
-
-CFLAGS="?"
- Pass these flags to the compiler.
-
-CPPFLAGS="?"
- Pass these flags to the C preprocessor.
-
-LDFLAGS="?"
- Pass these flags when linking.
-
-PATH="?"
- Use this to search for programs used during configuration and building.
-
-=== Development ================================================================
-
-If you intend to make non-trivial changes to jemalloc, use the 'autogen.sh'
-script rather than 'configure'. This re-generates 'configure', enables
-configuration dependency rules, and enables re-generation of automatically
-generated source files.
-
-The build system supports using an object directory separate from the source
-tree. For example, you can create an 'obj' directory, and from within that
-directory, issue configuration and build commands:
-
- autoconf
- mkdir obj
- cd obj
- ../configure --enable-autogen
- make
-
-=== Documentation ==============================================================
-
-The manual page is generated in both html and roff formats. Any web browser
-can be used to view the html manual. The roff manual page can be formatted
-prior to installation via the following command:
-
- nroff -man -t doc/jemalloc.3
View
323 deps/jemalloc/Makefile.in
@@ -1,323 +0,0 @@
-# Clear out all vpaths, then set just one (default vpath) for the main build
-# directory.
-vpath
-vpath % .
-
-# Clear the default suffixes, so that built-in rules are not used.
-.SUFFIXES :
-
-SHELL := /bin/sh
-
-CC := @CC@
-
-# Configuration parameters.
-DESTDIR =
-BINDIR := $(DESTDIR)@BINDIR@
-INCLUDEDIR := $(DESTDIR)@INCLUDEDIR@
-LIBDIR := $(DESTDIR)@LIBDIR@
-DATADIR := $(DESTDIR)@DATADIR@
-MANDIR := $(DESTDIR)@MANDIR@
-srcroot := @srcroot@
-objroot := @objroot@
-abs_srcroot := @abs_srcroot@
-abs_objroot := @abs_objroot@
-
-# Build parameters.
-CPPFLAGS := @CPPFLAGS@ -I$(srcroot)include -I$(objroot)include
-CFLAGS := @CFLAGS@
-LDFLAGS := @LDFLAGS@
-EXTRA_LDFLAGS := @EXTRA_LDFLAGS@
-LIBS := @LIBS@
-RPATH_EXTRA := @RPATH_EXTRA@
-SO := @so@
-IMPORTLIB := @importlib@
-O := @o@
-A := @a@
-EXE := @exe@
-LIBPREFIX := @libprefix@
-REV := @rev@
-install_suffix := @install_suffix@
-ABI := @abi@
-XSLTPROC := @XSLTPROC@
-AUTOCONF := @AUTOCONF@
-_RPATH = @RPATH@
-RPATH = $(if $(1),$(call _RPATH,$(1)))
-cfghdrs_in := @cfghdrs_in@
-cfghdrs_out := @cfghdrs_out@
-cfgoutputs_in := @cfgoutputs_in@
-cfgoutputs_out := @cfgoutputs_out@
-enable_autogen := @enable_autogen@
-enable_experimental := @enable_experimental@
-DSO_LDFLAGS = @DSO_LDFLAGS@
-SOREV = @SOREV@
-PIC_CFLAGS = @PIC_CFLAGS@
-CTARGET = @CTARGET@
-LDTARGET = @LDTARGET@
-MKLIB = @MKLIB@
-CC_MM = @CC_MM@
-
-ifeq (macho, $(ABI))
-TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH="$(objroot)lib"
-else
-ifeq (pecoff, $(ABI))
-TEST_LIBRARY_PATH := PATH="$(PATH):$(objroot)lib"
-else
-TEST_LIBRARY_PATH :=
-endif
-endif
-
-LIBJEMALLOC := $(LIBPREFIX)jemalloc$(install_suffix)
-
-# Lists of files.
-BINS := $(srcroot)bin/pprof $(objroot)bin/jemalloc.sh
-CHDRS := $(objroot)include/jemalloc/jemalloc$(install_suffix).h \
- $(objroot)include/jemalloc/jemalloc_defs$(install_suffix).h
-CSRCS := $(srcroot)src/jemalloc.c $(srcroot)src/arena.c $(srcroot)src/atomic.c \
- $(srcroot)src/base.c $(srcroot)src/bitmap.c $(srcroot)src/chunk.c \
- $(srcroot)src/chunk_dss.c $(srcroot)src/chunk_mmap.c \
- $(srcroot)src/ckh.c $(srcroot)src/ctl.c $(srcroot)src/extent.c \
- $(srcroot)src/hash.c $(srcroot)src/huge.c $(srcroot)src/mb.c \
- $(srcroot)src/mutex.c $(srcroot)src/prof.c $(srcroot)src/quarantine.c \
- $(srcroot)src/rtree.c $(srcroot)src/stats.c $(srcroot)src/tcache.c \
- $(srcroot)src/util.c $(srcroot)src/tsd.c
-ifeq (macho, $(ABI))
-CSRCS += $(srcroot)src/zone.c
-endif
-ifeq ($(IMPORTLIB),$(SO))
-STATIC_LIBS := $(objroot)lib/$(LIBJEMALLOC).$(A)
-endif
-ifdef PIC_CFLAGS
-STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_pic.$(A)
-else
-STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_s.$(A)
-endif
-DSOS := $(objroot)lib/$(LIBJEMALLOC).$(SOREV)
-ifneq ($(SOREV),$(SO))
-DSOS += $(objroot)lib/$(LIBJEMALLOC).$(SO)
-endif
-MAN3 := $(objroot)doc/jemalloc$(install_suffix).3
-DOCS_XML := $(objroot)doc/jemalloc$(install_suffix).xml
-DOCS_HTML := $(DOCS_XML:$(objroot)%.xml=$(srcroot)%.html)
-DOCS_MAN3 := $(DOCS_XML:$(objroot)%.xml=$(srcroot)%.3)
-DOCS := $(DOCS_HTML) $(DOCS_MAN3)
-CTESTS := $(srcroot)test/aligned_alloc.c $(srcroot)test/allocated.c \
- $(srcroot)test/ALLOCM_ARENA.c $(srcroot)test/bitmap.c \
- $(srcroot)test/mremap.c $(srcroot)test/posix_memalign.c \
- $(srcroot)test/thread_arena.c $(srcroot)test/thread_tcache_enabled.c
-ifeq ($(enable_experimental), 1)
-CTESTS += $(srcroot)test/allocm.c $(srcroot)test/rallocm.c
-endif
-
-COBJS := $(CSRCS:$(srcroot)%.c=$(objroot)%.$(O))
-CPICOBJS := $(CSRCS:$(srcroot)%.c=$(objroot)%.pic.$(O))
-CTESTOBJS := $(CTESTS:$(srcroot)%.c=$(objroot)%.$(O))
-
-.PHONY: all dist doc_html doc_man doc
-.PHONY: install_bin install_include install_lib
-.PHONY: install_html install_man install_doc install
-.PHONY: tests check clean distclean relclean
-
-.SECONDARY : $(CTESTOBJS)
-
-# Default target.
-all: build
-
-dist: build_doc
-
-$(srcroot)doc/%.html : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/html.xsl
- $(XSLTPROC) -o $@ $(objroot)doc/html.xsl $<
-
-$(srcroot)doc/%.3 : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/manpages.xsl
- $(XSLTPROC) -o $@ $(objroot)doc/manpages.xsl $<
-
-build_doc_html: $(DOCS_HTML)
-build_doc_man: $(DOCS_MAN3)
-build_doc: $(DOCS)
-
-#
-# Include generated dependency files.
-#
-ifdef CC_MM
--include $(COBJS:%.$(O)=%.d)
--include $(CPICOBJS:%.$(O)=%.d)
--include $(CTESTOBJS:%.$(O)=%.d)
-endif
-
-$(COBJS): $(objroot)src/%.$(O): $(srcroot)src/%.c
-$(CPICOBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.c
-$(CPICOBJS): CFLAGS += $(PIC_CFLAGS)
-$(CTESTOBJS): $(objroot)test/%.$(O): $(srcroot)test/%.c
-$(CTESTOBJS): CPPFLAGS += -I$(objroot)test
-ifneq ($(IMPORTLIB),$(SO))
-$(COBJS): CPPFLAGS += -DDLLEXPORT
-endif
-
-ifndef CC_MM
-# Dependencies
-HEADER_DIRS = $(srcroot)include/jemalloc/internal \
- $(objroot)include/jemalloc $(objroot)include/jemalloc/internal
-HEADERS = $(wildcard $(foreach dir,$(HEADER_DIRS),$(dir)/*.h))
-$(COBJS) $(CPICOBJS) $(CTESTOBJS): $(HEADERS)
-$(CTESTOBJS): $(objroot)test/jemalloc_test.h
-endif
-
-$(COBJS) $(CPICOBJS) $(CTESTOBJS): %.$(O):
- @mkdir -p $(@D)
- $(CC) $(CFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
-ifdef CC_MM
- @$(CC) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
-endif
-
-ifneq ($(SOREV),$(SO))
-%.$(SO) : %.$(SOREV)
- @mkdir -p $(@D)
- ln -sf $(<F) $@
-endif
-
-$(objroot)lib/$(LIBJEMALLOC).$(SOREV) : $(if $(PIC_CFLAGS),$(CPICOBJS),$(COBJS))
- @mkdir -p $(@D)
- $(CC) $(DSO_LDFLAGS) $(call RPATH,$(RPATH_EXTRA)) $(LDTARGET) $+ $(LDFLAGS) $(LIBS) $(EXTRA_LDFLAGS)
-
-$(objroot)lib/$(LIBJEMALLOC)_pic.$(A) : $(CPICOBJS)
-$(objroot)lib/$(LIBJEMALLOC).$(A) : $(COBJS)
-$(objroot)lib/$(LIBJEMALLOC)_s.$(A) : $(COBJS)
-
-$(STATIC_LIBS):
- @mkdir -p $(@D)
- $(MKLIB) $+
-
-$(objroot)test/bitmap$(EXE): $(objroot)src/bitmap.$(O)
-
-$(objroot)test/%$(EXE): $(objroot)test/%.$(O) $(objroot)src/util.$(O) $(DSOS)
- @mkdir -p $(@D)
- $(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(filter -lpthread,$(LIBS)) $(EXTRA_LDFLAGS)
-
-build_lib_shared: $(DSOS)
-build_lib_static: $(STATIC_LIBS)
-build: build_lib_shared build_lib_static
-
-install_bin:
- install -d $(BINDIR)
- @for b in $(BINS); do \
- echo "install -m 755 $$b $(BINDIR)"; \
- install -m 755 $$b $(BINDIR); \
-done
-
-install_include:
- install -d $(INCLUDEDIR)/jemalloc
- @for h in $(CHDRS); do \
- echo "install -m 644 $$h $(INCLUDEDIR)/jemalloc"; \
- install -m 644 $$h $(INCLUDEDIR)/jemalloc; \
-done
-
-install_lib_shared: $(DSOS)
- install -d $(LIBDIR)
- install -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(LIBDIR)
-ifneq ($(SOREV),$(SO))
- ln -sf $(LIBJEMALLOC).$(SOREV) $(LIBDIR)/$(LIBJEMALLOC).$(SO)
-endif
-
-install_lib_static: $(STATIC_LIBS)
- install -d $(LIBDIR)
- @for l in $(STATIC_LIBS); do \
- echo "install -m 755 $$l $(LIBDIR)"; \
- install -m 755 $$l $(LIBDIR); \
-done
-
-install_lib: install_lib_shared install_lib_static
-
-install_doc_html:
- install -d $(DATADIR)/doc/jemalloc$(install_suffix)
- @for d in $(DOCS_HTML); do \
- echo "install -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix)"; \
- install -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix); \
-done
-
-install_doc_man:
- install -d $(MANDIR)/man3
- @for d in $(DOCS_MAN3); do \
- echo "install -m 644 $$d $(MANDIR)/man3"; \
- install -m 644 $$d $(MANDIR)/man3; \
-done
-
-install_doc: install_doc_html install_doc_man
-
-install: install_bin install_include install_lib install_doc
-
-tests: $(CTESTS:$(srcroot)%.c=$(objroot)%$(EXE))
-
-check: tests
- @mkdir -p $(objroot)test
- @$(SHELL) -c 'total=0; \
- failures=0; \
- echo "========================================="; \
- for t in $(CTESTS:$(srcroot)%.c=$(objroot)%); do \
- total=`expr $$total + 1`; \
- /bin/echo -n "$${t} ... "; \
- $(TEST_LIBRARY_PATH) $${t}$(EXE) $(abs_srcroot) \
- $(abs_objroot) > $(objroot)$${t}.out 2>&1; \
- if test -e "$(srcroot)$${t}.exp"; then \
- diff -w -u $(srcroot)$${t}.exp \
- $(objroot)$${t}.out >/dev/null 2>&1; \
- fail=$$?; \
- if test "$${fail}" -eq "1" ; then \
- failures=`expr $${failures} + 1`; \
- echo "*** FAIL ***"; \
- else \
- echo "pass"; \
- fi; \
- else \
- echo "*** FAIL *** (.exp file is missing)"; \
- failures=`expr $${failures} + 1`; \
- fi; \
- done; \
- echo "========================================="; \
- echo "Failures: $${failures}/$${total}"'
-
-clean:
- rm -f $(COBJS)
- rm -f $(CPICOBJS)
- rm -f $(COBJS:%.$(O)=%.d)
- rm -f $(CPICOBJS:%.$(O)=%.d)
- rm -f $(CTESTOBJS:%.$(O)=%$(EXE))
- rm -f $(CTESTOBJS)
- rm -f $(CTESTOBJS:%.$(O)=%.d)
- rm -f $(CTESTOBJS:%.$(O)=%.out)
- rm -f $(DSOS) $(STATIC_LIBS)
-
-distclean: clean
- rm -rf $(objroot)autom4te.cache
- rm -f $(objroot)config.log
- rm -f $(objroot)config.status
- rm -f $(objroot)config.stamp
- rm -f $(cfghdrs_out)
- rm -f $(cfgoutputs_out)
-
-relclean: distclean
- rm -f $(objroot)configure
- rm -f $(srcroot)VERSION
- rm -f $(DOCS_HTML)
- rm -f $(DOCS_MAN3)
-
-#===============================================================================
-# Re-configuration rules.
-
-ifeq ($(enable_autogen), 1)
-$(srcroot)configure : $(srcroot)configure.ac
- cd ./$(srcroot) && $(AUTOCONF)
-
-$(objroot)config.status : $(srcroot)configure
- ./$(objroot)config.status --recheck
-
-$(srcroot)config.stamp.in : $(srcroot)configure.ac
- echo stamp > $(srcroot)config.stamp.in
-
-$(objroot)config.stamp : $(cfgoutputs_in) $(cfghdrs_in) $(srcroot)configure
- ./$(objroot)config.status
- @touch $@
-
-# There must be some action in order for make to re-read Makefile when it is
-# out of date.
-$(cfgoutputs_out) $(cfghdrs_out) : $(objroot)config.stamp
- @true
-endif
View
16 deps/jemalloc/README
@@ -1,16 +0,0 @@
-jemalloc is a general-purpose scalable concurrent malloc(3) implementation.
-This distribution is a "portable" implementation that currently targets
-FreeBSD, Linux, Apple OS X, and MinGW. jemalloc is included as the default
-allocator in the FreeBSD and NetBSD operating systems, and it is used by the
-Mozilla Firefox web browser on Microsoft Windows-related platforms. Depending
-on your needs, one of the other divergent versions may suit your needs better
-than this distribution.
-
-The COPYING file contains copyright and licensing information.
-
-The INSTALL file contains information on how to configure, build, and install
-jemalloc.
-
-The ChangeLog file contains a brief summary of changes for each release.
-
-URL: http://www.canonware.com/jemalloc/
View
1  deps/jemalloc/VERSION
@@ -1 +0,0 @@
-3.2.0-0-g87499f6748ebe4817571e817e9f680ccb5bf54a9
View
17 deps/jemalloc/autogen.sh
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-for i in autoconf; do
- echo "$i"
- $i
- if [ $? -ne 0 ]; then
- echo "Error $? in $i"
- exit 1
- fi
-done
-
-echo "./configure --enable-autogen $@"
-./configure --enable-autogen $@
-if [ $? -ne 0 ]; then
- echo "Error $? in ./configure"
- exit 1
-fi
View
9 deps/jemalloc/bin/jemalloc.sh.in
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-
-@LD_PRELOAD_VAR@=${libdir}/libjemalloc.@SOREV@
-export @LD_PRELOAD_VAR@
-exec "$@"
View
5,348 deps/jemalloc/bin/pprof
0 additions, 5,348 deletions not shown
View
1,530 deps/jemalloc/config.guess
@@ -1,1530 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
-
-timestamp='2012-02-10'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner. Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
-#
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`