diff --git a/TODO b/TODO index 4fff80a850b6e5cdcef34f068c2b6fff145ca2cf..0540346f70794eb62460baa4b587a5d4bc3ed6aa 100644 --- a/TODO +++ b/TODO @@ -1,12 +1,10 @@ BEFORE REDIS 1.0.0-rc1 * Add number of keys for every DB in INFO - * maxmemory support * Resize the expires and Sets hash tables if needed as well? For Sets the right moment to check for this is probably in SREM * What happens if the saving child gets killed or segfaults instead of ending normally? Handle this. * check 'server.dirty' everywere. Make it proprotional to the number of objects modified. * Shutdown must kill other background savings before to start saving. Otherwise the DB can get replaced by the child that rename(2) after the parent for some reason. Child should trap the signal and remove the temp file name. - * Objects sharing configuration, add the directive `objectsharingpool ` * Make sure to convert all the fstat() calls to 64bit versions. * Cover most of the source code with test-redis.tcl diff --git a/config.h b/config.h new file mode 100644 index 0000000000000000000000000000000000000000..79240b754030104e92d66741e9525a315ba9f53e --- /dev/null +++ b/config.h @@ -0,0 +1,20 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +/* malloc_size() */ +#ifdef __APPLE__ +#include +#define HAVE_MALLOC_SIZE +#define redis_malloc_size(p) malloc_size(p) +#endif + +/* define redis_fstat to fstat or fstat64() */ +#ifdef __APPLE__ +#define redis_fstat fstat64 +#define redis_stat stat64 +#else +#define redis_fstat fstat +#define redis_stat stat +#endif + +#endif diff --git a/redis.c b/redis.c index 39d45a2ddc7f1467f1d6574be80e2b16dba5f2e1..28e1c64f7fc7227482d875db93c402af0bdc23f3 100644 --- a/redis.c +++ b/redis.c @@ -60,6 +60,8 @@ #include "lzf.h" /* LZF compression library */ #include "pqsort.h" /* Partial qsort for SORT+LIMIT */ +#include "config.h" + /* Error codes */ #define REDIS_OK 0 #define REDIS_ERR -1 @@ -3866,7 +3868,7 @@ static void updateSalvesWaitingBgsave(int bgsaveerr) { startbgsave = 1; slave->replstate = REDIS_REPL_WAIT_BGSAVE_END; } else if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_END) { - struct stat buf; + struct redis_stat buf; if (bgsaveerr != REDIS_OK) { freeClient(slave); @@ -3874,7 +3876,7 @@ static void updateSalvesWaitingBgsave(int bgsaveerr) { continue; } if ((slave->repldbfd = open(server.dbfilename,O_RDONLY)) == -1 || - fstat(slave->repldbfd,&buf) == -1) { + redis_fstat(slave->repldbfd,&buf) == -1) { freeClient(slave); redisLog(REDIS_WARNING,"SYNC failed. Can't open/stat DB after BGSAVE: %s", strerror(errno)); continue; diff --git a/zmalloc.c b/zmalloc.c index 4cb2c53c635002bae4b27d7aec3ba7dba91604b5..c813d6b82e854287138e55329b75437035274a5c 100644 --- a/zmalloc.c +++ b/zmalloc.c @@ -30,12 +30,7 @@ #include #include - -#ifdef __APPLE__ -#include -#define HAVE_MALLOC_SIZE -#define redis_malloc_size(p) malloc_size(p) -#endif +#include "config.h" static size_t used_memory = 0;