mirror of https://mirror.osredm.com/root/redis.git
Remove prototypes with empty declarations (#12020)
Technically declaring a prototype with an empty declaration has been deprecated since the early days of C, but we never got a warning for it. C2x will apparently be introducing a breaking change if you are using this type of declarator, so Clang 15 has started issuing a warning with -pedantic. Although not apparently a problem for any of the compiler we build on, if feels like the right thing is to properly adhere to the C standard and use (void).
This commit is contained in:
parent
8163e816fe
commit
5e3be1be09
|
@ -40,7 +40,7 @@ ifneq (,$(findstring FreeBSD,$(uname_S)))
|
||||||
STD+=-Wno-c11-extensions
|
STD+=-Wno-c11-extensions
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
WARN=-Wall -W -Wno-missing-field-initializers -Werror=deprecated-declarations
|
WARN=-Wall -W -Wno-missing-field-initializers -Werror=deprecated-declarations -Wstrict-prototypes
|
||||||
OPT=$(OPTIMIZATION)
|
OPT=$(OPTIMIZATION)
|
||||||
|
|
||||||
# Detect if the compiler supports C11 _Atomic.
|
# Detect if the compiler supports C11 _Atomic.
|
||||||
|
|
|
@ -642,7 +642,7 @@ void ACLSetSelectorCommandBitsForCategory(dict *commands, aclSelector *selector,
|
||||||
/* This function is responsible for recomputing the command bits for all selectors of the existing users.
|
/* This function is responsible for recomputing the command bits for all selectors of the existing users.
|
||||||
* It uses the 'command_rules', a string representation of the ordered categories and commands,
|
* It uses the 'command_rules', a string representation of the ordered categories and commands,
|
||||||
* to recompute the command bits. */
|
* to recompute the command bits. */
|
||||||
void ACLRecomputeCommandBitsFromCommandRulesAllUsers() {
|
void ACLRecomputeCommandBitsFromCommandRulesAllUsers(void) {
|
||||||
raxIterator ri;
|
raxIterator ri;
|
||||||
raxStart(&ri,Users);
|
raxStart(&ri,Users);
|
||||||
raxSeek(&ri,"^",NULL,0);
|
raxSeek(&ri,"^",NULL,0);
|
||||||
|
|
|
@ -164,12 +164,12 @@ void aofManifestFree(aofManifest *am) {
|
||||||
zfree(am);
|
zfree(am);
|
||||||
}
|
}
|
||||||
|
|
||||||
sds getAofManifestFileName() {
|
sds getAofManifestFileName(void) {
|
||||||
return sdscatprintf(sdsempty(), "%s%s", server.aof_filename,
|
return sdscatprintf(sdsempty(), "%s%s", server.aof_filename,
|
||||||
MANIFEST_NAME_SUFFIX);
|
MANIFEST_NAME_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
sds getTempAofManifestFileName() {
|
sds getTempAofManifestFileName(void) {
|
||||||
return sdscatprintf(sdsempty(), "%s%s%s", TEMP_FILE_NAME_PREFIX,
|
return sdscatprintf(sdsempty(), "%s%s%s", TEMP_FILE_NAME_PREFIX,
|
||||||
server.aof_filename, MANIFEST_NAME_SUFFIX);
|
server.aof_filename, MANIFEST_NAME_SUFFIX);
|
||||||
}
|
}
|
||||||
|
@ -464,7 +464,7 @@ sds getNewIncrAofName(aofManifest *am) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get temp INCR type AOF name. */
|
/* Get temp INCR type AOF name. */
|
||||||
sds getTempIncrAofName() {
|
sds getTempIncrAofName(void) {
|
||||||
return sdscatprintf(sdsempty(), "%s%s%s", TEMP_FILE_NAME_PREFIX, server.aof_filename,
|
return sdscatprintf(sdsempty(), "%s%s%s", TEMP_FILE_NAME_PREFIX, server.aof_filename,
|
||||||
INCR_FILE_SUFFIX);
|
INCR_FILE_SUFFIX);
|
||||||
}
|
}
|
||||||
|
@ -692,7 +692,7 @@ int aofDelHistoryFiles(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used to clean up temp INCR AOF when AOFRW fails. */
|
/* Used to clean up temp INCR AOF when AOFRW fails. */
|
||||||
void aofDelTempIncrAofFile() {
|
void aofDelTempIncrAofFile(void) {
|
||||||
sds aof_filename = getTempIncrAofName();
|
sds aof_filename = getTempIncrAofName();
|
||||||
sds aof_filepath = makePath(server.aof_dirname, aof_filename);
|
sds aof_filepath = makePath(server.aof_dirname, aof_filename);
|
||||||
serverLog(LL_NOTICE, "Removing the temp incr aof file %s in the background", aof_filename);
|
serverLog(LL_NOTICE, "Removing the temp incr aof file %s in the background", aof_filename);
|
||||||
|
|
|
@ -191,7 +191,7 @@ ssize_t cliWriteConn(redisContext *c, const char *buf, size_t buf_len)
|
||||||
|
|
||||||
/* Wrapper around OpenSSL (libssl and libcrypto) initialisation
|
/* Wrapper around OpenSSL (libssl and libcrypto) initialisation
|
||||||
*/
|
*/
|
||||||
int cliSecureInit()
|
int cliSecureInit(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENSSL
|
#ifdef USE_OPENSSL
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
|
@ -37,7 +37,7 @@ int cliSecureConnection(redisContext *c, cliSSLconfig config, const char **err);
|
||||||
|
|
||||||
ssize_t cliWriteConn(redisContext *c, const char *buf, size_t buf_len);
|
ssize_t cliWriteConn(redisContext *c, const char *buf, size_t buf_len);
|
||||||
|
|
||||||
int cliSecureInit();
|
int cliSecureInit(void);
|
||||||
|
|
||||||
sds readArgFromStdin(void);
|
sds readArgFromStdin(void);
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ dictType clusterNodesBlackListDictType = {
|
||||||
NULL /* allow to expand */
|
NULL /* allow to expand */
|
||||||
};
|
};
|
||||||
|
|
||||||
static ConnectionType *connTypeOfCluster() {
|
static ConnectionType *connTypeOfCluster(void) {
|
||||||
if (server.tls_cluster) {
|
if (server.tls_cluster) {
|
||||||
return connectionTypeTls();
|
return connectionTypeTls();
|
||||||
}
|
}
|
||||||
|
@ -2321,18 +2321,18 @@ uint32_t getAlignedPingExtSize(uint32_t dataSize) {
|
||||||
return sizeof(clusterMsgPingExt) + EIGHT_BYTE_ALIGN(dataSize);
|
return sizeof(clusterMsgPingExt) + EIGHT_BYTE_ALIGN(dataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getHostnamePingExtSize() {
|
uint32_t getHostnamePingExtSize(void) {
|
||||||
if (sdslen(myself->hostname) == 0) {
|
if (sdslen(myself->hostname) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return getAlignedPingExtSize(sdslen(myself->hostname) + 1);
|
return getAlignedPingExtSize(sdslen(myself->hostname) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getShardIdPingExtSize() {
|
uint32_t getShardIdPingExtSize(void) {
|
||||||
return getAlignedPingExtSize(sizeof(clusterMsgPingExtShardId));
|
return getAlignedPingExtSize(sizeof(clusterMsgPingExtShardId));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getForgottenNodeExtSize() {
|
uint32_t getForgottenNodeExtSize(void) {
|
||||||
return getAlignedPingExtSize(sizeof(clusterMsgPingExtForgottenNode));
|
return getAlignedPingExtSize(sizeof(clusterMsgPingExtForgottenNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5559,7 +5559,7 @@ void clusterReplyMultiBulkSlots(client * c) {
|
||||||
setDeferredArrayLen(c, slot_replylen, num_masters);
|
setDeferredArrayLen(c, slot_replylen, num_masters);
|
||||||
}
|
}
|
||||||
|
|
||||||
sds genClusterInfoString() {
|
sds genClusterInfoString(void) {
|
||||||
sds info = sdsempty();
|
sds info = sdsempty();
|
||||||
char *statestr[] = {"ok","fail"};
|
char *statestr[] = {"ok","fail"};
|
||||||
int slots_assigned = 0, slots_ok = 0, slots_pfail = 0, slots_fail = 0;
|
int slots_assigned = 0, slots_ok = 0, slots_pfail = 0, slots_fail = 0;
|
||||||
|
|
|
@ -423,7 +423,7 @@ void slotToChannelDel(sds channel);
|
||||||
void clusterUpdateMyselfHostname(void);
|
void clusterUpdateMyselfHostname(void);
|
||||||
void clusterUpdateMyselfAnnouncedPorts(void);
|
void clusterUpdateMyselfAnnouncedPorts(void);
|
||||||
sds clusterGenNodesDescription(int filter, int use_pport);
|
sds clusterGenNodesDescription(int filter, int use_pport);
|
||||||
sds genClusterInfoString();
|
sds genClusterInfoString(void);
|
||||||
void freeClusterLink(clusterLink *link);
|
void freeClusterLink(clusterLink *link);
|
||||||
|
|
||||||
#endif /* __CLUSTER_H */
|
#endif /* __CLUSTER_H */
|
||||||
|
|
|
@ -1065,7 +1065,7 @@ void rewriteConfigReleaseState(struct rewriteConfigState *state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the configuration rewrite state */
|
/* Create the configuration rewrite state */
|
||||||
struct rewriteConfigState *rewriteConfigCreateState() {
|
struct rewriteConfigState *rewriteConfigCreateState(void) {
|
||||||
struct rewriteConfigState *state = zmalloc(sizeof(*state));
|
struct rewriteConfigState *state = zmalloc(sizeof(*state));
|
||||||
state->option_to_line = dictCreate(&optionToLineDictType);
|
state->option_to_line = dictCreate(&optionToLineDictType);
|
||||||
state->rewritten = dictCreate(&optionSetDictType);
|
state->rewritten = dictCreate(&optionSetDictType);
|
||||||
|
@ -1643,7 +1643,7 @@ void rewriteConfigRemoveOrphaned(struct rewriteConfigState *state) {
|
||||||
|
|
||||||
/* This function returns a string representation of all the config options
|
/* This function returns a string representation of all the config options
|
||||||
* marked with DEBUG_CONFIG, which can be used to help with debugging. */
|
* marked with DEBUG_CONFIG, which can be used to help with debugging. */
|
||||||
sds getConfigDebugInfo() {
|
sds getConfigDebugInfo(void) {
|
||||||
struct rewriteConfigState *state = rewriteConfigCreateState();
|
struct rewriteConfigState *state = rewriteConfigCreateState();
|
||||||
state->force_write = 1; /* Force the output */
|
state->force_write = 1; /* Force the output */
|
||||||
state->needs_signature = 0; /* Omit the rewrite signature */
|
state->needs_signature = 0; /* Omit the rewrite signature */
|
||||||
|
@ -3260,7 +3260,7 @@ int registerConfigValue(const char *name, const standardConfig *config, int alia
|
||||||
|
|
||||||
/* Initialize configs to their default values and create and populate the
|
/* Initialize configs to their default values and create and populate the
|
||||||
* runtime configuration dictionary. */
|
* runtime configuration dictionary. */
|
||||||
void initConfigValues() {
|
void initConfigValues(void) {
|
||||||
configs = dictCreate(&sdsHashDictType);
|
configs = dictCreate(&sdsHashDictType);
|
||||||
dictExpand(configs, sizeof(static_configs) / sizeof(standardConfig));
|
dictExpand(configs, sizeof(static_configs) / sizeof(standardConfig));
|
||||||
for (standardConfig *config = static_configs; config->name != NULL; config++) {
|
for (standardConfig *config = static_configs; config->name != NULL; config++) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ int connTypeRegister(ConnectionType *ct) {
|
||||||
return C_OK;
|
return C_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int connTypeInitialize() {
|
int connTypeInitialize(void) {
|
||||||
/* currently socket connection type is necessary */
|
/* currently socket connection type is necessary */
|
||||||
serverAssert(RedisRegisterConnectionTypeSocket() == C_OK);
|
serverAssert(RedisRegisterConnectionTypeSocket() == C_OK);
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ ConnectionType *connectionByType(const char *typename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cache TCP connection type, query it by string once */
|
/* Cache TCP connection type, query it by string once */
|
||||||
ConnectionType *connectionTypeTcp() {
|
ConnectionType *connectionTypeTcp(void) {
|
||||||
static ConnectionType *ct_tcp = NULL;
|
static ConnectionType *ct_tcp = NULL;
|
||||||
|
|
||||||
if (ct_tcp != NULL)
|
if (ct_tcp != NULL)
|
||||||
|
@ -101,7 +101,7 @@ ConnectionType *connectionTypeTcp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cache TLS connection type, query it by string once */
|
/* Cache TLS connection type, query it by string once */
|
||||||
ConnectionType *connectionTypeTls() {
|
ConnectionType *connectionTypeTls(void) {
|
||||||
static ConnectionType *ct_tls = NULL;
|
static ConnectionType *ct_tls = NULL;
|
||||||
static int cached = 0;
|
static int cached = 0;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ ConnectionType *connectionTypeTls() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cache Unix connection type, query it by string once */
|
/* Cache Unix connection type, query it by string once */
|
||||||
ConnectionType *connectionTypeUnix() {
|
ConnectionType *connectionTypeUnix(void) {
|
||||||
static ConnectionType *ct_unix = NULL;
|
static ConnectionType *ct_unix = NULL;
|
||||||
|
|
||||||
if (ct_unix != NULL)
|
if (ct_unix != NULL)
|
||||||
|
@ -141,7 +141,7 @@ int connectionIndexByType(const char *typename) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void connTypeCleanupAll() {
|
void connTypeCleanupAll(void) {
|
||||||
ConnectionType *ct;
|
ConnectionType *ct;
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
|
|
|
@ -379,7 +379,7 @@ static inline sds connGetPeerCert(connection *conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the redis connection framework */
|
/* Initialize the redis connection framework */
|
||||||
int connTypeInitialize();
|
int connTypeInitialize(void);
|
||||||
|
|
||||||
/* Register a connection type into redis connection framework */
|
/* Register a connection type into redis connection framework */
|
||||||
int connTypeRegister(ConnectionType *ct);
|
int connTypeRegister(ConnectionType *ct);
|
||||||
|
@ -388,13 +388,13 @@ int connTypeRegister(ConnectionType *ct);
|
||||||
ConnectionType *connectionByType(const char *typename);
|
ConnectionType *connectionByType(const char *typename);
|
||||||
|
|
||||||
/* Fast path to get TCP connection type */
|
/* Fast path to get TCP connection type */
|
||||||
ConnectionType *connectionTypeTcp();
|
ConnectionType *connectionTypeTcp(void);
|
||||||
|
|
||||||
/* Fast path to get TLS connection type */
|
/* Fast path to get TLS connection type */
|
||||||
ConnectionType *connectionTypeTls();
|
ConnectionType *connectionTypeTls(void);
|
||||||
|
|
||||||
/* Fast path to get Unix connection type */
|
/* Fast path to get Unix connection type */
|
||||||
ConnectionType *connectionTypeUnix();
|
ConnectionType *connectionTypeUnix(void);
|
||||||
|
|
||||||
/* Lookup the index of a connection type by type name, return -1 if not found */
|
/* Lookup the index of a connection type by type name, return -1 if not found */
|
||||||
int connectionIndexByType(const char *typename);
|
int connectionIndexByType(const char *typename);
|
||||||
|
@ -418,7 +418,7 @@ static inline int connTypeConfigure(ConnectionType *ct, void *priv, int reconfig
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Walk all the connection types and cleanup them all if possible */
|
/* Walk all the connection types and cleanup them all if possible */
|
||||||
void connTypeCleanupAll();
|
void connTypeCleanupAll(void);
|
||||||
|
|
||||||
/* Test all the connection type has pending data or not. */
|
/* Test all the connection type has pending data or not. */
|
||||||
int connTypeHasPendingData(void);
|
int connTypeHasPendingData(void);
|
||||||
|
@ -441,8 +441,8 @@ static inline aeFileProc *connAcceptHandler(ConnectionType *ct) {
|
||||||
/* Get Listeners information, note that caller should free the non-empty string */
|
/* Get Listeners information, note that caller should free the non-empty string */
|
||||||
sds getListensInfoString(sds info);
|
sds getListensInfoString(sds info);
|
||||||
|
|
||||||
int RedisRegisterConnectionTypeSocket();
|
int RedisRegisterConnectionTypeSocket(void);
|
||||||
int RedisRegisterConnectionTypeUnix();
|
int RedisRegisterConnectionTypeUnix(void);
|
||||||
int RedisRegisterConnectionTypeTLS();
|
int RedisRegisterConnectionTypeTLS(void);
|
||||||
|
|
||||||
#endif /* __REDIS_CONNECTION_H */
|
#endif /* __REDIS_CONNECTION_H */
|
||||||
|
|
2
src/db.c
2
src/db.c
|
@ -562,7 +562,7 @@ int selectDb(client *c, int id) {
|
||||||
return C_OK;
|
return C_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
long long dbTotalServerKeyCount() {
|
long long dbTotalServerKeyCount(void) {
|
||||||
long long total = 0;
|
long long total = 0;
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < server.dbnum; j++) {
|
for (j = 0; j < server.dbnum; j++) {
|
||||||
|
|
|
@ -2056,9 +2056,9 @@ void dumpCodeAroundEIP(void *eip) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void invalidFunctionWasCalled() {}
|
void invalidFunctionWasCalled(void) {}
|
||||||
|
|
||||||
typedef void (*invalidFunctionWasCalledType)();
|
typedef void (*invalidFunctionWasCalledType)(void);
|
||||||
|
|
||||||
void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
|
void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
|
||||||
UNUSED(secret);
|
UNUSED(secret);
|
||||||
|
@ -2227,7 +2227,7 @@ void watchdogScheduleSignal(int period) {
|
||||||
it.it_interval.tv_usec = 0;
|
it.it_interval.tv_usec = 0;
|
||||||
setitimer(ITIMER_REAL, &it, NULL);
|
setitimer(ITIMER_REAL, &it, NULL);
|
||||||
}
|
}
|
||||||
void applyWatchdogPeriod() {
|
void applyWatchdogPeriod(void) {
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
|
|
||||||
/* Disable watchdog when period is 0 */
|
/* Disable watchdog when period is 0 */
|
||||||
|
|
|
@ -781,7 +781,7 @@ float getAllocatorFragmentation(size_t *out_frag_bytes) {
|
||||||
|
|
||||||
/* We may need to defrag other globals, one small allocation can hold a full allocator run.
|
/* We may need to defrag other globals, one small allocation can hold a full allocator run.
|
||||||
* so although small, it is still important to defrag these */
|
* so although small, it is still important to defrag these */
|
||||||
void defragOtherGlobals() {
|
void defragOtherGlobals(void) {
|
||||||
|
|
||||||
/* there are many more pointers to defrag (e.g. client argv, output / aof buffers, etc.
|
/* there are many more pointers to defrag (e.g. client argv, output / aof buffers, etc.
|
||||||
* but we assume most of these are short lived, we only need to defrag allocations
|
* but we assume most of these are short lived, we only need to defrag allocations
|
||||||
|
@ -887,7 +887,7 @@ int defragLaterStep(redisDb *db, long long endtime) {
|
||||||
#define LIMIT(y, min, max) ((y)<(min)? min: ((y)>(max)? max: (y)))
|
#define LIMIT(y, min, max) ((y)<(min)? min: ((y)>(max)? max: (y)))
|
||||||
|
|
||||||
/* decide if defrag is needed, and at what CPU effort to invest in it */
|
/* decide if defrag is needed, and at what CPU effort to invest in it */
|
||||||
void computeDefragCycles() {
|
void computeDefragCycles(void) {
|
||||||
size_t frag_bytes;
|
size_t frag_bytes;
|
||||||
float frag_pct = getAllocatorFragmentation(&frag_bytes);
|
float frag_pct = getAllocatorFragmentation(&frag_bytes);
|
||||||
/* If we're not already running, and below the threshold, exit. */
|
/* If we're not already running, and below the threshold, exit. */
|
||||||
|
|
|
@ -650,15 +650,15 @@ NULL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long evalMemory() {
|
unsigned long evalMemory(void) {
|
||||||
return luaMemory(lctx.lua);
|
return luaMemory(lctx.lua);
|
||||||
}
|
}
|
||||||
|
|
||||||
dict* evalScriptsDict() {
|
dict* evalScriptsDict(void) {
|
||||||
return lctx.lua_scripts;
|
return lctx.lua_scripts;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long evalScriptsMemory() {
|
unsigned long evalScriptsMemory(void) {
|
||||||
return lctx.lua_scripts_mem +
|
return lctx.lua_scripts_mem +
|
||||||
dictMemUsage(lctx.lua_scripts) +
|
dictMemUsage(lctx.lua_scripts) +
|
||||||
dictSize(lctx.lua_scripts) * sizeof(luaScript);
|
dictSize(lctx.lua_scripts) * sizeof(luaScript);
|
||||||
|
@ -688,7 +688,7 @@ void ldbFlushLog(list *log) {
|
||||||
listDelNode(log,ln);
|
listDelNode(log,ln);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ldbIsEnabled(){
|
int ldbIsEnabled(void){
|
||||||
return ldb.active && ldb.step;
|
return ldb.active && ldb.step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -494,7 +494,7 @@ static int isSafeToPerformEvictions(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Algorithm for converting tenacity (0-100) to a time limit. */
|
/* Algorithm for converting tenacity (0-100) to a time limit. */
|
||||||
static unsigned long evictionTimeLimitUs() {
|
static unsigned long evictionTimeLimitUs(void) {
|
||||||
serverAssert(server.maxmemory_eviction_tenacity >= 0);
|
serverAssert(server.maxmemory_eviction_tenacity >= 0);
|
||||||
serverAssert(server.maxmemory_eviction_tenacity <= 100);
|
serverAssert(server.maxmemory_eviction_tenacity <= 100);
|
||||||
|
|
||||||
|
|
|
@ -420,7 +420,7 @@ static int luaRegisterFunction(lua_State *lua) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize Lua engine, should be called once on start. */
|
/* Initialize Lua engine, should be called once on start. */
|
||||||
int luaEngineInitEngine() {
|
int luaEngineInitEngine(void) {
|
||||||
luaEngineCtx *lua_engine_ctx = zmalloc(sizeof(*lua_engine_ctx));
|
luaEngineCtx *lua_engine_ctx = zmalloc(sizeof(*lua_engine_ctx));
|
||||||
lua_engine_ctx->lua = lua_open();
|
lua_engine_ctx->lua = lua_open();
|
||||||
|
|
||||||
|
|
|
@ -212,12 +212,12 @@ void functionsLibCtxSwapWithCurrent(functionsLibCtx *new_lib_ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the current functions ctx */
|
/* return the current functions ctx */
|
||||||
functionsLibCtx* functionsLibCtxGetCurrent() {
|
functionsLibCtx* functionsLibCtxGetCurrent(void) {
|
||||||
return curr_functions_lib_ctx;
|
return curr_functions_lib_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new functions ctx */
|
/* Create a new functions ctx */
|
||||||
functionsLibCtx* functionsLibCtxCreate() {
|
functionsLibCtx* functionsLibCtxCreate(void) {
|
||||||
functionsLibCtx *ret = zmalloc(sizeof(functionsLibCtx));
|
functionsLibCtx *ret = zmalloc(sizeof(functionsLibCtx));
|
||||||
ret->libraries = dictCreate(&librariesDictType);
|
ret->libraries = dictCreate(&librariesDictType);
|
||||||
ret->functions = dictCreate(&functionDictType);
|
ret->functions = dictCreate(&functionDictType);
|
||||||
|
@ -1075,7 +1075,7 @@ void functionLoadCommand(client *c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return memory usage of all the engines combine */
|
/* Return memory usage of all the engines combine */
|
||||||
unsigned long functionsMemory() {
|
unsigned long functionsMemory(void) {
|
||||||
dictIterator *iter = dictGetIterator(engines);
|
dictIterator *iter = dictGetIterator(engines);
|
||||||
dictEntry *entry = NULL;
|
dictEntry *entry = NULL;
|
||||||
size_t engines_nemory = 0;
|
size_t engines_nemory = 0;
|
||||||
|
@ -1090,7 +1090,7 @@ unsigned long functionsMemory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return memory overhead of all the engines combine */
|
/* Return memory overhead of all the engines combine */
|
||||||
unsigned long functionsMemoryOverhead() {
|
unsigned long functionsMemoryOverhead(void) {
|
||||||
size_t memory_overhead = dictMemUsage(engines);
|
size_t memory_overhead = dictMemUsage(engines);
|
||||||
memory_overhead += dictMemUsage(curr_functions_lib_ctx->functions);
|
memory_overhead += dictMemUsage(curr_functions_lib_ctx->functions);
|
||||||
memory_overhead += sizeof(functionsLibCtx);
|
memory_overhead += sizeof(functionsLibCtx);
|
||||||
|
@ -1101,15 +1101,15 @@ unsigned long functionsMemoryOverhead() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the number of functions */
|
/* Returns the number of functions */
|
||||||
unsigned long functionsNum() {
|
unsigned long functionsNum(void) {
|
||||||
return dictSize(curr_functions_lib_ctx->functions);
|
return dictSize(curr_functions_lib_ctx->functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long functionsLibNum() {
|
unsigned long functionsLibNum(void) {
|
||||||
return dictSize(curr_functions_lib_ctx->libraries);
|
return dictSize(curr_functions_lib_ctx->libraries);
|
||||||
}
|
}
|
||||||
|
|
||||||
dict* functionsLibGet() {
|
dict* functionsLibGet(void) {
|
||||||
return curr_functions_lib_ctx->libraries;
|
return curr_functions_lib_ctx->libraries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1119,7 +1119,7 @@ size_t functionsLibCtxfunctionsLen(functionsLibCtx *functions_ctx) {
|
||||||
|
|
||||||
/* Initialize engine data structures.
|
/* Initialize engine data structures.
|
||||||
* Should be called once on server initialization */
|
* Should be called once on server initialization */
|
||||||
int functionsInit() {
|
int functionsInit(void) {
|
||||||
engines = dictCreate(&engineDictType);
|
engines = dictCreate(&engineDictType);
|
||||||
|
|
||||||
if (luaEngineInitEngine() != C_OK) {
|
if (luaEngineInitEngine() != C_OK) {
|
||||||
|
|
|
@ -110,14 +110,14 @@ struct functionLibInfo {
|
||||||
|
|
||||||
int functionsRegisterEngine(const char *engine_name, engine *engine_ctx);
|
int functionsRegisterEngine(const char *engine_name, engine *engine_ctx);
|
||||||
sds functionsCreateWithLibraryCtx(sds code, int replace, sds* err, functionsLibCtx *lib_ctx);
|
sds functionsCreateWithLibraryCtx(sds code, int replace, sds* err, functionsLibCtx *lib_ctx);
|
||||||
unsigned long functionsMemory();
|
unsigned long functionsMemory(void);
|
||||||
unsigned long functionsMemoryOverhead();
|
unsigned long functionsMemoryOverhead(void);
|
||||||
unsigned long functionsNum();
|
unsigned long functionsNum(void);
|
||||||
unsigned long functionsLibNum();
|
unsigned long functionsLibNum(void);
|
||||||
dict* functionsLibGet();
|
dict* functionsLibGet(void);
|
||||||
size_t functionsLibCtxfunctionsLen(functionsLibCtx *functions_ctx);
|
size_t functionsLibCtxfunctionsLen(functionsLibCtx *functions_ctx);
|
||||||
functionsLibCtx* functionsLibCtxGetCurrent();
|
functionsLibCtx* functionsLibCtxGetCurrent(void);
|
||||||
functionsLibCtx* functionsLibCtxCreate();
|
functionsLibCtx* functionsLibCtxCreate(void);
|
||||||
void functionsLibCtxClearCurrent(int async);
|
void functionsLibCtxClearCurrent(int async);
|
||||||
void functionsLibCtxFree(functionsLibCtx *lib_ctx);
|
void functionsLibCtxFree(functionsLibCtx *lib_ctx);
|
||||||
void functionsLibCtxClear(functionsLibCtx *lib_ctx);
|
void functionsLibCtxClear(functionsLibCtx *lib_ctx);
|
||||||
|
@ -125,7 +125,7 @@ void functionsLibCtxSwapWithCurrent(functionsLibCtx *lib_ctx);
|
||||||
|
|
||||||
int functionLibCreateFunction(sds name, void *function, functionLibInfo *li, sds desc, uint64_t f_flags, sds *err);
|
int functionLibCreateFunction(sds name, void *function, functionLibInfo *li, sds desc, uint64_t f_flags, sds *err);
|
||||||
|
|
||||||
int luaEngineInitEngine();
|
int luaEngineInitEngine(void);
|
||||||
int functionsInit();
|
int functionsInit(void);
|
||||||
|
|
||||||
#endif /* __FUNCTIONS_H_ */
|
#endif /* __FUNCTIONS_H_ */
|
||||||
|
|
|
@ -82,7 +82,7 @@ size_t lazyfreeGetFreedObjectsCount(void) {
|
||||||
return aux;
|
return aux;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lazyfreeResetStats() {
|
void lazyfreeResetStats(void) {
|
||||||
atomicSet(lazyfreed_objects,0);
|
atomicSet(lazyfreed_objects,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1693,7 +1693,7 @@ char *mixlist[] = {"hello", "foo", "quux", "1024"};
|
||||||
char *intlist[] = {"4294967296", "-100", "100", "128000",
|
char *intlist[] = {"4294967296", "-100", "100", "128000",
|
||||||
"non integer", "much much longer non integer"};
|
"non integer", "much much longer non integer"};
|
||||||
|
|
||||||
static unsigned char *createList() {
|
static unsigned char *createList(void) {
|
||||||
unsigned char *lp = lpNew(0);
|
unsigned char *lp = lpNew(0);
|
||||||
lp = lpAppend(lp, (unsigned char*)mixlist[1], strlen(mixlist[1]));
|
lp = lpAppend(lp, (unsigned char*)mixlist[1], strlen(mixlist[1]));
|
||||||
lp = lpAppend(lp, (unsigned char*)mixlist[2], strlen(mixlist[2]));
|
lp = lpAppend(lp, (unsigned char*)mixlist[2], strlen(mixlist[2]));
|
||||||
|
@ -1702,7 +1702,7 @@ static unsigned char *createList() {
|
||||||
return lp;
|
return lp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char *createIntList() {
|
static unsigned char *createIntList(void) {
|
||||||
unsigned char *lp = lpNew(0);
|
unsigned char *lp = lpNew(0);
|
||||||
lp = lpAppend(lp, (unsigned char*)intlist[2], strlen(intlist[2]));
|
lp = lpAppend(lp, (unsigned char*)intlist[2], strlen(intlist[2]));
|
||||||
lp = lpAppend(lp, (unsigned char*)intlist[3], strlen(intlist[3]));
|
lp = lpAppend(lp, (unsigned char*)intlist[3], strlen(intlist[3]));
|
||||||
|
|
40
src/module.c
40
src/module.c
|
@ -789,7 +789,7 @@ int RM_GetApi(const char *funcname, void **targetPtrPtr) {
|
||||||
return REDISMODULE_OK;
|
return REDISMODULE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void modulePostExecutionUnitOperations() {
|
void modulePostExecutionUnitOperations(void) {
|
||||||
if (server.execution_nesting)
|
if (server.execution_nesting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2276,7 +2276,7 @@ uint64_t RM_MonotonicMicroseconds(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the current UNIX time in microseconds */
|
/* Return the current UNIX time in microseconds */
|
||||||
ustime_t RM_Microseconds() {
|
ustime_t RM_Microseconds(void) {
|
||||||
return ustime();
|
return ustime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2286,7 +2286,7 @@ ustime_t RM_Microseconds() {
|
||||||
* key space notification, causing a module to execute a RedisModule_Call,
|
* key space notification, causing a module to execute a RedisModule_Call,
|
||||||
* causing another notification, etc.
|
* causing another notification, etc.
|
||||||
* It makes sense that all this callbacks would use the same clock. */
|
* It makes sense that all this callbacks would use the same clock. */
|
||||||
ustime_t RM_CachedMicroseconds() {
|
ustime_t RM_CachedMicroseconds(void) {
|
||||||
return server.ustime;
|
return server.ustime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3913,7 +3913,7 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) {
|
||||||
* garbage collection tasks, or that do writes and replicate such writes
|
* garbage collection tasks, or that do writes and replicate such writes
|
||||||
* periodically in timer callbacks or other periodic callbacks.
|
* periodically in timer callbacks or other periodic callbacks.
|
||||||
*/
|
*/
|
||||||
int RM_AvoidReplicaTraffic() {
|
int RM_AvoidReplicaTraffic(void) {
|
||||||
return !!(isPausedActionsWithUpdate(PAUSE_ACTION_REPLICA));
|
return !!(isPausedActionsWithUpdate(PAUSE_ACTION_REPLICA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4023,7 +4023,7 @@ RedisModuleKey *RM_OpenKey(RedisModuleCtx *ctx, robj *keyname, int mode) {
|
||||||
* // REDISMODULE_OPEN_KEY_NOTOUCH is not supported
|
* // REDISMODULE_OPEN_KEY_NOTOUCH is not supported
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
int RM_GetOpenKeyModesAll() {
|
int RM_GetOpenKeyModesAll(void) {
|
||||||
return _REDISMODULE_OPEN_KEY_ALL;
|
return _REDISMODULE_OPEN_KEY_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6950,7 +6950,7 @@ void moduleRDBLoadError(RedisModuleIO *io) {
|
||||||
/* Returns 0 if there's at least one registered data type that did not declare
|
/* Returns 0 if there's at least one registered data type that did not declare
|
||||||
* REDISMODULE_OPTIONS_HANDLE_IO_ERRORS, in which case diskless loading should
|
* REDISMODULE_OPTIONS_HANDLE_IO_ERRORS, in which case diskless loading should
|
||||||
* be avoided since it could cause data loss. */
|
* be avoided since it could cause data loss. */
|
||||||
int moduleAllDatatypesHandleErrors() {
|
int moduleAllDatatypesHandleErrors(void) {
|
||||||
dictIterator *di = dictGetIterator(modules);
|
dictIterator *di = dictGetIterator(modules);
|
||||||
dictEntry *de;
|
dictEntry *de;
|
||||||
|
|
||||||
|
@ -6970,7 +6970,7 @@ int moduleAllDatatypesHandleErrors() {
|
||||||
/* Returns 0 if module did not declare REDISMODULE_OPTIONS_HANDLE_REPL_ASYNC_LOAD, in which case
|
/* Returns 0 if module did not declare REDISMODULE_OPTIONS_HANDLE_REPL_ASYNC_LOAD, in which case
|
||||||
* diskless async loading should be avoided because module doesn't know there can be traffic during
|
* diskless async loading should be avoided because module doesn't know there can be traffic during
|
||||||
* database full resynchronization. */
|
* database full resynchronization. */
|
||||||
int moduleAllModulesHandleReplAsyncLoad() {
|
int moduleAllModulesHandleReplAsyncLoad(void) {
|
||||||
dictIterator *di = dictGetIterator(modules);
|
dictIterator *di = dictGetIterator(modules);
|
||||||
dictEntry *de;
|
dictEntry *de;
|
||||||
|
|
||||||
|
@ -8418,7 +8418,7 @@ void RM_FreeThreadSafeContext(RedisModuleCtx *ctx) {
|
||||||
zfree(ctx);
|
zfree(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void moduleGILAfterLock() {
|
void moduleGILAfterLock(void) {
|
||||||
/* We should never get here if we already inside a module
|
/* We should never get here if we already inside a module
|
||||||
* code block which already opened a context. */
|
* code block which already opened a context. */
|
||||||
serverAssert(server.execution_nesting == 0);
|
serverAssert(server.execution_nesting == 0);
|
||||||
|
@ -8454,7 +8454,7 @@ int RM_ThreadSafeContextTryLock(RedisModuleCtx *ctx) {
|
||||||
return REDISMODULE_OK;
|
return REDISMODULE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void moduleGILBeforeUnlock() {
|
void moduleGILBeforeUnlock(void) {
|
||||||
/* We should never get here if we already inside a module
|
/* We should never get here if we already inside a module
|
||||||
* code block which already opened a context, except
|
* code block which already opened a context, except
|
||||||
* the bump-up from moduleGILAcquired. */
|
* the bump-up from moduleGILAcquired. */
|
||||||
|
@ -8569,7 +8569,7 @@ int RM_SubscribeToKeyspaceEvents(RedisModuleCtx *ctx, int types, RedisModuleNoti
|
||||||
return REDISMODULE_OK;
|
return REDISMODULE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void firePostExecutionUnitJobs() {
|
void firePostExecutionUnitJobs(void) {
|
||||||
/* Avoid propagation of commands.
|
/* Avoid propagation of commands.
|
||||||
* In that way, postExecutionUnitOperations will prevent
|
* In that way, postExecutionUnitOperations will prevent
|
||||||
* recursive calls to firePostExecutionUnitJobs.
|
* recursive calls to firePostExecutionUnitJobs.
|
||||||
|
@ -8622,7 +8622,7 @@ int RM_AddPostNotificationJob(RedisModuleCtx *ctx, RedisModulePostNotificationJo
|
||||||
|
|
||||||
/* Get the configured bitmap of notify-keyspace-events (Could be used
|
/* Get the configured bitmap of notify-keyspace-events (Could be used
|
||||||
* for additional filtering in RedisModuleNotificationFunc) */
|
* for additional filtering in RedisModuleNotificationFunc) */
|
||||||
int RM_GetNotifyKeyspaceEvents() {
|
int RM_GetNotifyKeyspaceEvents(void) {
|
||||||
return server.notify_keyspace_events;
|
return server.notify_keyspace_events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9337,7 +9337,7 @@ int RM_EventLoopAddOneShot(RedisModuleEventLoopOneShotFunc func, void *user_data
|
||||||
|
|
||||||
/* This function will check the moduleEventLoopOneShots queue in order to
|
/* This function will check the moduleEventLoopOneShots queue in order to
|
||||||
* call the callback for the registered oneshot events. */
|
* call the callback for the registered oneshot events. */
|
||||||
static void eventLoopHandleOneShotEvents() {
|
static void eventLoopHandleOneShotEvents(void) {
|
||||||
pthread_mutex_lock(&moduleEventLoopMutex);
|
pthread_mutex_lock(&moduleEventLoopMutex);
|
||||||
if (moduleEventLoopOneShots) {
|
if (moduleEventLoopOneShots) {
|
||||||
while (listLength(moduleEventLoopOneShots)) {
|
while (listLength(moduleEventLoopOneShots)) {
|
||||||
|
@ -10438,7 +10438,7 @@ int RM_ExportSharedAPI(RedisModuleCtx *ctx, const char *apiname, void *func) {
|
||||||
*
|
*
|
||||||
* Here is an example:
|
* Here is an example:
|
||||||
*
|
*
|
||||||
* int ... myCommandImplementation() {
|
* int ... myCommandImplementation(void) {
|
||||||
* if (getExternalAPIs() == 0) {
|
* if (getExternalAPIs() == 0) {
|
||||||
* reply with an error here if we cannot have the APIs
|
* reply with an error here if we cannot have the APIs
|
||||||
* }
|
* }
|
||||||
|
@ -10771,7 +10771,7 @@ size_t RM_MallocSizeDict(RedisModuleDict* dict) {
|
||||||
* * Exactly 1 - Memory limit reached.
|
* * Exactly 1 - Memory limit reached.
|
||||||
* * Greater 1 - More memory used than the configured limit.
|
* * Greater 1 - More memory used than the configured limit.
|
||||||
*/
|
*/
|
||||||
float RM_GetUsedMemoryRatio(){
|
float RM_GetUsedMemoryRatio(void){
|
||||||
float level;
|
float level;
|
||||||
getMaxmemoryState(NULL, NULL, NULL, &level);
|
getMaxmemoryState(NULL, NULL, NULL, &level);
|
||||||
return level;
|
return level;
|
||||||
|
@ -10810,7 +10810,7 @@ static void moduleScanCallback(void *privdata, const dictEntry *de) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new cursor to be used with RedisModule_Scan */
|
/* Create a new cursor to be used with RedisModule_Scan */
|
||||||
RedisModuleScanCursor *RM_ScanCursorCreate() {
|
RedisModuleScanCursor *RM_ScanCursorCreate(void) {
|
||||||
RedisModuleScanCursor* cursor = zmalloc(sizeof(*cursor));
|
RedisModuleScanCursor* cursor = zmalloc(sizeof(*cursor));
|
||||||
cursor->cursor = 0;
|
cursor->cursor = 0;
|
||||||
cursor->done = 0;
|
cursor->done = 0;
|
||||||
|
@ -13068,7 +13068,7 @@ int RM_GetLFU(RedisModuleKey *key, long long *lfu_freq) {
|
||||||
* // REDISMODULE_OPTIONS_ALLOW_NESTED_KEYSPACE_NOTIFICATIONS is not supported
|
* // REDISMODULE_OPTIONS_ALLOW_NESTED_KEYSPACE_NOTIFICATIONS is not supported
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
int RM_GetModuleOptionsAll() {
|
int RM_GetModuleOptionsAll(void) {
|
||||||
return _REDISMODULE_OPTIONS_FLAGS_NEXT - 1;
|
return _REDISMODULE_OPTIONS_FLAGS_NEXT - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13085,7 +13085,7 @@ int RM_GetModuleOptionsAll() {
|
||||||
* // REDISMODULE_CTX_FLAGS_MULTI is not supported
|
* // REDISMODULE_CTX_FLAGS_MULTI is not supported
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
int RM_GetContextFlagsAll() {
|
int RM_GetContextFlagsAll(void) {
|
||||||
return _REDISMODULE_CTX_FLAGS_NEXT - 1;
|
return _REDISMODULE_CTX_FLAGS_NEXT - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13102,7 +13102,7 @@ int RM_GetContextFlagsAll() {
|
||||||
* // REDISMODULE_NOTIFY_LOADED is not supported
|
* // REDISMODULE_NOTIFY_LOADED is not supported
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
int RM_GetKeyspaceNotificationFlagsAll() {
|
int RM_GetKeyspaceNotificationFlagsAll(void) {
|
||||||
return _REDISMODULE_NOTIFY_NEXT - 1;
|
return _REDISMODULE_NOTIFY_NEXT - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13110,7 +13110,7 @@ int RM_GetKeyspaceNotificationFlagsAll() {
|
||||||
* Return the redis version in format of 0x00MMmmpp.
|
* Return the redis version in format of 0x00MMmmpp.
|
||||||
* Example for 6.0.7 the return value will be 0x00060007.
|
* Example for 6.0.7 the return value will be 0x00060007.
|
||||||
*/
|
*/
|
||||||
int RM_GetServerVersion() {
|
int RM_GetServerVersion(void) {
|
||||||
return REDIS_VERSION_NUM;
|
return REDIS_VERSION_NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13119,7 +13119,7 @@ int RM_GetServerVersion() {
|
||||||
* You can use that when calling RM_CreateDataType to know which fields of
|
* You can use that when calling RM_CreateDataType to know which fields of
|
||||||
* RedisModuleTypeMethods are gonna be supported and which will be ignored.
|
* RedisModuleTypeMethods are gonna be supported and which will be ignored.
|
||||||
*/
|
*/
|
||||||
int RM_GetTypeMethodVersion() {
|
int RM_GetTypeMethodVersion(void) {
|
||||||
return REDISMODULE_TYPE_METHOD_VERSION;
|
return REDISMODULE_TYPE_METHOD_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,11 @@ static char monotonic_info_string[32];
|
||||||
|
|
||||||
static long mono_ticksPerMicrosecond = 0;
|
static long mono_ticksPerMicrosecond = 0;
|
||||||
|
|
||||||
static monotime getMonotonicUs_x86() {
|
static monotime getMonotonicUs_x86(void) {
|
||||||
return __rdtsc() / mono_ticksPerMicrosecond;
|
return __rdtsc() / mono_ticksPerMicrosecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monotonicInit_x86linux() {
|
static void monotonicInit_x86linux(void) {
|
||||||
const int bufflen = 256;
|
const int bufflen = 256;
|
||||||
char buf[bufflen];
|
char buf[bufflen];
|
||||||
regex_t cpuGhzRegex, constTscRegex;
|
regex_t cpuGhzRegex, constTscRegex;
|
||||||
|
@ -99,24 +99,24 @@ static void monotonicInit_x86linux() {
|
||||||
static long mono_ticksPerMicrosecond = 0;
|
static long mono_ticksPerMicrosecond = 0;
|
||||||
|
|
||||||
/* Read the clock value. */
|
/* Read the clock value. */
|
||||||
static inline uint64_t __cntvct() {
|
static inline uint64_t __cntvct(void) {
|
||||||
uint64_t virtual_timer_value;
|
uint64_t virtual_timer_value;
|
||||||
__asm__ volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value));
|
__asm__ volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value));
|
||||||
return virtual_timer_value;
|
return virtual_timer_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the Count-timer Frequency. */
|
/* Read the Count-timer Frequency. */
|
||||||
static inline uint32_t cntfrq_hz() {
|
static inline uint32_t cntfrq_hz(void) {
|
||||||
uint64_t virtual_freq_value;
|
uint64_t virtual_freq_value;
|
||||||
__asm__ volatile("mrs %0, cntfrq_el0" : "=r"(virtual_freq_value));
|
__asm__ volatile("mrs %0, cntfrq_el0" : "=r"(virtual_freq_value));
|
||||||
return (uint32_t)virtual_freq_value; /* top 32 bits are reserved */
|
return (uint32_t)virtual_freq_value; /* top 32 bits are reserved */
|
||||||
}
|
}
|
||||||
|
|
||||||
static monotime getMonotonicUs_aarch64() {
|
static monotime getMonotonicUs_aarch64(void) {
|
||||||
return __cntvct() / mono_ticksPerMicrosecond;
|
return __cntvct() / mono_ticksPerMicrosecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monotonicInit_aarch64() {
|
static void monotonicInit_aarch64(void) {
|
||||||
mono_ticksPerMicrosecond = (long)cntfrq_hz() / 1000L / 1000L;
|
mono_ticksPerMicrosecond = (long)cntfrq_hz() / 1000L / 1000L;
|
||||||
if (mono_ticksPerMicrosecond == 0) {
|
if (mono_ticksPerMicrosecond == 0) {
|
||||||
fprintf(stderr, "monotonic: aarch64, unable to determine clock rate");
|
fprintf(stderr, "monotonic: aarch64, unable to determine clock rate");
|
||||||
|
@ -130,7 +130,7 @@ static void monotonicInit_aarch64() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static monotime getMonotonicUs_posix() {
|
static monotime getMonotonicUs_posix(void) {
|
||||||
/* clock_gettime() is specified in POSIX.1b (1993). Even so, some systems
|
/* clock_gettime() is specified in POSIX.1b (1993). Even so, some systems
|
||||||
* did not support this until much later. CLOCK_MONOTONIC is technically
|
* did not support this until much later. CLOCK_MONOTONIC is technically
|
||||||
* optional and may not be supported - but it appears to be universal.
|
* optional and may not be supported - but it appears to be universal.
|
||||||
|
@ -140,7 +140,7 @@ static monotime getMonotonicUs_posix() {
|
||||||
return ((uint64_t)ts.tv_sec) * 1000000 + ts.tv_nsec / 1000;
|
return ((uint64_t)ts.tv_sec) * 1000000 + ts.tv_nsec / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monotonicInit_posix() {
|
static void monotonicInit_posix(void) {
|
||||||
/* Ensure that CLOCK_MONOTONIC is supported. This should be supported
|
/* Ensure that CLOCK_MONOTONIC is supported. This should be supported
|
||||||
* on any reasonably current OS. If the assertion below fails, provide
|
* on any reasonably current OS. If the assertion below fails, provide
|
||||||
* an appropriate alternate implementation. */
|
* an appropriate alternate implementation. */
|
||||||
|
@ -155,7 +155,7 @@ static void monotonicInit_posix() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const char * monotonicInit() {
|
const char * monotonicInit(void) {
|
||||||
#if defined(USE_PROCESSOR_CLOCK) && defined(__x86_64__) && defined(__linux__)
|
#if defined(USE_PROCESSOR_CLOCK) && defined(__x86_64__) && defined(__linux__)
|
||||||
if (getMonotonicUs == NULL) monotonicInit_x86linux();
|
if (getMonotonicUs == NULL) monotonicInit_x86linux();
|
||||||
#endif
|
#endif
|
||||||
|
@ -169,11 +169,11 @@ const char * monotonicInit() {
|
||||||
return monotonic_info_string;
|
return monotonic_info_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *monotonicInfoString() {
|
const char *monotonicInfoString(void) {
|
||||||
return monotonic_info_string;
|
return monotonic_info_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
monotonic_clock_type monotonicGetType() {
|
monotonic_clock_type monotonicGetType(void) {
|
||||||
if (getMonotonicUs == getMonotonicUs_posix)
|
if (getMonotonicUs == getMonotonicUs_posix)
|
||||||
return MONOTONIC_CLOCK_POSIX;
|
return MONOTONIC_CLOCK_POSIX;
|
||||||
return MONOTONIC_CLOCK_HW;
|
return MONOTONIC_CLOCK_HW;
|
||||||
|
|
|
@ -33,13 +33,13 @@ typedef enum monotonic_clock_type {
|
||||||
* needs to be called once, it may be called additional times without impact.
|
* needs to be called once, it may be called additional times without impact.
|
||||||
* Returns a printable string indicating the type of clock initialized.
|
* Returns a printable string indicating the type of clock initialized.
|
||||||
* (The returned string is static and doesn't need to be freed.) */
|
* (The returned string is static and doesn't need to be freed.) */
|
||||||
const char *monotonicInit();
|
const char *monotonicInit(void);
|
||||||
|
|
||||||
/* Return a string indicating the type of monotonic clock being used. */
|
/* Return a string indicating the type of monotonic clock being used. */
|
||||||
const char *monotonicInfoString();
|
const char *monotonicInfoString(void);
|
||||||
|
|
||||||
/* Return the type of monotonic clock being used. */
|
/* Return the type of monotonic clock being used. */
|
||||||
monotonic_clock_type monotonicGetType();
|
monotonic_clock_type monotonicGetType(void);
|
||||||
|
|
||||||
/* Functions to measure elapsed time. Example:
|
/* Functions to measure elapsed time. Example:
|
||||||
* monotime myTimer;
|
* monotime myTimer;
|
||||||
|
|
|
@ -3981,7 +3981,7 @@ void updatePausedActions(void) {
|
||||||
|
|
||||||
/* Unblock all paused clients (ones that where blocked by BLOCKED_POSTPONE (possibly in processCommand).
|
/* Unblock all paused clients (ones that where blocked by BLOCKED_POSTPONE (possibly in processCommand).
|
||||||
* This means they'll get re-processed in beforeSleep, and may get paused again if needed. */
|
* This means they'll get re-processed in beforeSleep, and may get paused again if needed. */
|
||||||
void unblockPostponedClients() {
|
void unblockPostponedClients(void) {
|
||||||
listNode *ln;
|
listNode *ln;
|
||||||
listIter li;
|
listIter li;
|
||||||
listRewind(server.postponed_clients, &li);
|
listRewind(server.postponed_clients, &li);
|
||||||
|
|
|
@ -207,12 +207,12 @@ void addReplyPubsubPatUnsubscribed(client *c, robj *pattern) {
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* Return the number of pubsub channels + patterns is handled. */
|
/* Return the number of pubsub channels + patterns is handled. */
|
||||||
int serverPubsubSubscriptionCount() {
|
int serverPubsubSubscriptionCount(void) {
|
||||||
return dictSize(server.pubsub_channels) + dictSize(server.pubsub_patterns);
|
return dictSize(server.pubsub_channels) + dictSize(server.pubsub_patterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the number of pubsub shard level channels is handled. */
|
/* Return the number of pubsub shard level channels is handled. */
|
||||||
int serverPubsubShardSubscriptionCount() {
|
int serverPubsubShardSubscriptionCount(void) {
|
||||||
return dictSize(server.pubsubshard_channels);
|
return dictSize(server.pubsubshard_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
static uint32_t x[3] = { X0, X1, X2 }, a[3] = { A0, A1, A2 }, c = C;
|
static uint32_t x[3] = { X0, X1, X2 }, a[3] = { A0, A1, A2 }, c = C;
|
||||||
static void next(void);
|
static void next(void);
|
||||||
|
|
||||||
int32_t redisLrand48() {
|
int32_t redisLrand48(void) {
|
||||||
next();
|
next();
|
||||||
return (((int32_t)x[2] << (N - 1)) + (x[1] >> 1));
|
return (((int32_t)x[2] << (N - 1)) + (x[1] >> 1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#ifndef REDIS_RANDOM_H
|
#ifndef REDIS_RANDOM_H
|
||||||
#define REDIS_RANDOM_H
|
#define REDIS_RANDOM_H
|
||||||
|
|
||||||
int32_t redisLrand48();
|
int32_t redisLrand48(void);
|
||||||
void redisSrand48(int32_t seedval);
|
void redisSrand48(int32_t seedval);
|
||||||
|
|
||||||
#define REDIS_LRAND48_MAX INT32_MAX
|
#define REDIS_LRAND48_MAX INT32_MAX
|
||||||
|
|
|
@ -192,7 +192,7 @@ static void writeHandler(aeEventLoop *el, int fd, void *privdata, int mask);
|
||||||
static void createMissingClients(client c);
|
static void createMissingClients(client c);
|
||||||
static benchmarkThread *createBenchmarkThread(int index);
|
static benchmarkThread *createBenchmarkThread(int index);
|
||||||
static void freeBenchmarkThread(benchmarkThread *thread);
|
static void freeBenchmarkThread(benchmarkThread *thread);
|
||||||
static void freeBenchmarkThreads();
|
static void freeBenchmarkThreads(void);
|
||||||
static void *execBenchmarkThread(void *ptr);
|
static void *execBenchmarkThread(void *ptr);
|
||||||
static clusterNode *createClusterNode(char *ip, int port);
|
static clusterNode *createClusterNode(char *ip, int port);
|
||||||
static redisConfig *getRedisConfig(const char *ip, int port,
|
static redisConfig *getRedisConfig(const char *ip, int port,
|
||||||
|
@ -201,7 +201,7 @@ static redisContext *getRedisContext(const char *ip, int port,
|
||||||
const char *hostsocket);
|
const char *hostsocket);
|
||||||
static void freeRedisConfig(redisConfig *cfg);
|
static void freeRedisConfig(redisConfig *cfg);
|
||||||
static int fetchClusterSlotsConfiguration(client c);
|
static int fetchClusterSlotsConfiguration(client c);
|
||||||
static void updateClusterSlotsConfiguration();
|
static void updateClusterSlotsConfiguration(void);
|
||||||
int showThroughput(struct aeEventLoop *eventLoop, long long id,
|
int showThroughput(struct aeEventLoop *eventLoop, long long id,
|
||||||
void *clientData);
|
void *clientData);
|
||||||
|
|
||||||
|
@ -958,7 +958,7 @@ static void showLatencyReport(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initBenchmarkThreads() {
|
static void initBenchmarkThreads(void) {
|
||||||
int i;
|
int i;
|
||||||
if (config.threads) freeBenchmarkThreads();
|
if (config.threads) freeBenchmarkThreads();
|
||||||
config.threads = zmalloc(config.num_threads * sizeof(benchmarkThread*));
|
config.threads = zmalloc(config.num_threads * sizeof(benchmarkThread*));
|
||||||
|
@ -968,7 +968,7 @@ static void initBenchmarkThreads() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void startBenchmarkThreads() {
|
static void startBenchmarkThreads(void) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < config.num_threads; i++) {
|
for (i = 0; i < config.num_threads; i++) {
|
||||||
benchmarkThread *t = config.threads[i];
|
benchmarkThread *t = config.threads[i];
|
||||||
|
@ -1035,7 +1035,7 @@ static void freeBenchmarkThread(benchmarkThread *thread) {
|
||||||
zfree(thread);
|
zfree(thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void freeBenchmarkThreads() {
|
static void freeBenchmarkThreads(void) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; i < config.num_threads; i++) {
|
for (; i < config.num_threads; i++) {
|
||||||
benchmarkThread *thread = config.threads[i];
|
benchmarkThread *thread = config.threads[i];
|
||||||
|
@ -1096,7 +1096,7 @@ static void freeClusterNode(clusterNode *node) {
|
||||||
zfree(node);
|
zfree(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void freeClusterNodes() {
|
static void freeClusterNodes(void) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; i < config.cluster_node_count; i++) {
|
for (; i < config.cluster_node_count; i++) {
|
||||||
clusterNode *n = config.cluster_nodes[i];
|
clusterNode *n = config.cluster_nodes[i];
|
||||||
|
@ -1118,7 +1118,7 @@ static clusterNode **addClusterNode(clusterNode *node) {
|
||||||
/* TODO: This should be refactored to use CLUSTER SLOTS, the migrating/importing
|
/* TODO: This should be refactored to use CLUSTER SLOTS, the migrating/importing
|
||||||
* information is anyway not used.
|
* information is anyway not used.
|
||||||
*/
|
*/
|
||||||
static int fetchClusterConfiguration() {
|
static int fetchClusterConfiguration(void) {
|
||||||
int success = 1;
|
int success = 1;
|
||||||
redisContext *ctx = NULL;
|
redisContext *ctx = NULL;
|
||||||
redisReply *reply = NULL;
|
redisReply *reply = NULL;
|
||||||
|
@ -1377,7 +1377,7 @@ cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Atomically update the new slots configuration. */
|
/* Atomically update the new slots configuration. */
|
||||||
static void updateClusterSlotsConfiguration() {
|
static void updateClusterSlotsConfiguration(void) {
|
||||||
pthread_mutex_lock(&config.is_updating_slots_mutex);
|
pthread_mutex_lock(&config.is_updating_slots_mutex);
|
||||||
atomicSet(config.is_updating_slots, 1);
|
atomicSet(config.is_updating_slots, 1);
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -848,7 +848,7 @@ static size_t cliLegacyCountCommands(struct commandDocs *commands, sds version)
|
||||||
/* Gets the server version string by calling INFO SERVER.
|
/* Gets the server version string by calling INFO SERVER.
|
||||||
* Stores the result in config.server_version.
|
* Stores the result in config.server_version.
|
||||||
* When not connected, or not possible, returns NULL. */
|
* When not connected, or not possible, returns NULL. */
|
||||||
static sds cliGetServerVersion() {
|
static sds cliGetServerVersion(void) {
|
||||||
static const char *key = "\nredis_version:";
|
static const char *key = "\nredis_version:";
|
||||||
redisReply *serverInfo = NULL;
|
redisReply *serverInfo = NULL;
|
||||||
char *pos;
|
char *pos;
|
||||||
|
@ -1724,7 +1724,7 @@ static int cliConnect(int flags) {
|
||||||
|
|
||||||
/* In cluster, if server replies ASK, we will redirect to a different node.
|
/* In cluster, if server replies ASK, we will redirect to a different node.
|
||||||
* Before sending the real command, we need to send ASKING command first. */
|
* Before sending the real command, we need to send ASKING command first. */
|
||||||
static int cliSendAsking() {
|
static int cliSendAsking(void) {
|
||||||
redisReply *reply;
|
redisReply *reply;
|
||||||
|
|
||||||
config.cluster_send_asking = 0;
|
config.cluster_send_asking = 0;
|
||||||
|
@ -2319,7 +2319,7 @@ static int cliReadReply(int output_raw_strings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Simultaneously wait for pubsub messages from redis and input on stdin. */
|
/* Simultaneously wait for pubsub messages from redis and input on stdin. */
|
||||||
static void cliWaitForMessagesOrStdin() {
|
static void cliWaitForMessagesOrStdin(void) {
|
||||||
int show_info = config.output != OUTPUT_RAW && (isatty(STDOUT_FILENO) ||
|
int show_info = config.output != OUTPUT_RAW && (isatty(STDOUT_FILENO) ||
|
||||||
getenv("FAKETTY"));
|
getenv("FAKETTY"));
|
||||||
int use_color = show_info && isColorTerm();
|
int use_color = show_info && isColorTerm();
|
||||||
|
@ -2965,7 +2965,7 @@ static int parseOptions(int argc, char **argv) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parseEnv() {
|
static void parseEnv(void) {
|
||||||
/* Set auth from env, but do not overwrite CLI arguments if passed */
|
/* Set auth from env, but do not overwrite CLI arguments if passed */
|
||||||
char *auth = getenv(REDIS_CLI_AUTH_ENV);
|
char *auth = getenv(REDIS_CLI_AUTH_ENV);
|
||||||
if (auth != NULL && config.conn_info.auth == NULL) {
|
if (auth != NULL && config.conn_info.auth == NULL) {
|
||||||
|
@ -5870,7 +5870,7 @@ static clusterManagerNode * clusterManagerGetNodeWithMostKeysInSlot(list *nodes,
|
||||||
* in the cluster. If there are multiple masters with the same smaller
|
* in the cluster. If there are multiple masters with the same smaller
|
||||||
* number of replicas, one at random is returned. */
|
* number of replicas, one at random is returned. */
|
||||||
|
|
||||||
static clusterManagerNode *clusterManagerNodeWithLeastReplicas() {
|
static clusterManagerNode *clusterManagerNodeWithLeastReplicas(void) {
|
||||||
clusterManagerNode *node = NULL;
|
clusterManagerNode *node = NULL;
|
||||||
int lowest_count = 0;
|
int lowest_count = 0;
|
||||||
listIter li;
|
listIter li;
|
||||||
|
@ -5889,7 +5889,7 @@ static clusterManagerNode *clusterManagerNodeWithLeastReplicas() {
|
||||||
|
|
||||||
/* This function returns a random master node, return NULL if none */
|
/* This function returns a random master node, return NULL if none */
|
||||||
|
|
||||||
static clusterManagerNode *clusterManagerNodeMasterRandom() {
|
static clusterManagerNode *clusterManagerNodeMasterRandom(void) {
|
||||||
int master_count = 0;
|
int master_count = 0;
|
||||||
int idx;
|
int idx;
|
||||||
listIter li;
|
listIter li;
|
||||||
|
@ -8391,7 +8391,7 @@ int sendReplconf(const char* arg1, const char* arg2) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendCapa() {
|
void sendCapa(void) {
|
||||||
sendReplconf("capa", "eof");
|
sendReplconf("capa", "eof");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -976,7 +976,7 @@ REDISMODULE_API int (*RedisModule_GetSelectedDb)(RedisModuleCtx *ctx) REDISMODUL
|
||||||
REDISMODULE_API int (*RedisModule_SelectDb)(RedisModuleCtx *ctx, int newid) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_SelectDb)(RedisModuleCtx *ctx, int newid) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_KeyExists)(RedisModuleCtx *ctx, RedisModuleString *keyname) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_KeyExists)(RedisModuleCtx *ctx, RedisModuleString *keyname) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API RedisModuleKey * (*RedisModule_OpenKey)(RedisModuleCtx *ctx, RedisModuleString *keyname, int mode) REDISMODULE_ATTR;
|
REDISMODULE_API RedisModuleKey * (*RedisModule_OpenKey)(RedisModuleCtx *ctx, RedisModuleString *keyname, int mode) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_GetOpenKeyModesAll)() REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_GetOpenKeyModesAll)(void) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API void (*RedisModule_CloseKey)(RedisModuleKey *kp) REDISMODULE_ATTR;
|
REDISMODULE_API void (*RedisModule_CloseKey)(RedisModuleKey *kp) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_KeyType)(RedisModuleKey *kp) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_KeyType)(RedisModuleKey *kp) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API size_t (*RedisModule_ValueLength)(RedisModuleKey *kp) REDISMODULE_ATTR;
|
REDISMODULE_API size_t (*RedisModule_ValueLength)(RedisModuleKey *kp) REDISMODULE_ATTR;
|
||||||
|
@ -1098,7 +1098,7 @@ REDISMODULE_API int (*RedisModule_SetClientNameById)(uint64_t id, RedisModuleStr
|
||||||
REDISMODULE_API int (*RedisModule_PublishMessage)(RedisModuleCtx *ctx, RedisModuleString *channel, RedisModuleString *message) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_PublishMessage)(RedisModuleCtx *ctx, RedisModuleString *channel, RedisModuleString *message) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_PublishMessageShard)(RedisModuleCtx *ctx, RedisModuleString *channel, RedisModuleString *message) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_PublishMessageShard)(RedisModuleCtx *ctx, RedisModuleString *channel, RedisModuleString *message) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_GetContextFlags)(RedisModuleCtx *ctx) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_GetContextFlags)(RedisModuleCtx *ctx) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_AvoidReplicaTraffic)() REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_AvoidReplicaTraffic)(void) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API void * (*RedisModule_PoolAlloc)(RedisModuleCtx *ctx, size_t bytes) REDISMODULE_ATTR;
|
REDISMODULE_API void * (*RedisModule_PoolAlloc)(RedisModuleCtx *ctx, size_t bytes) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API RedisModuleType * (*RedisModule_CreateDataType)(RedisModuleCtx *ctx, const char *name, int encver, RedisModuleTypeMethods *typemethods) REDISMODULE_ATTR;
|
REDISMODULE_API RedisModuleType * (*RedisModule_CreateDataType)(RedisModuleCtx *ctx, const char *name, int encver, RedisModuleTypeMethods *typemethods) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_ModuleTypeSetValue)(RedisModuleKey *key, RedisModuleType *mt, void *value) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_ModuleTypeSetValue)(RedisModuleKey *key, RedisModuleType *mt, void *value) REDISMODULE_ATTR;
|
||||||
|
@ -1201,17 +1201,17 @@ REDISMODULE_API RedisModuleBlockedClient * (*RedisModule_BlockClientOnKeys)(Redi
|
||||||
REDISMODULE_API RedisModuleBlockedClient * (*RedisModule_BlockClientOnKeysWithFlags)(RedisModuleCtx *ctx, RedisModuleCmdFunc reply_callback, RedisModuleCmdFunc timeout_callback, void (*free_privdata)(RedisModuleCtx*,void*), long long timeout_ms, RedisModuleString **keys, int numkeys, void *privdata, int flags) REDISMODULE_ATTR;
|
REDISMODULE_API RedisModuleBlockedClient * (*RedisModule_BlockClientOnKeysWithFlags)(RedisModuleCtx *ctx, RedisModuleCmdFunc reply_callback, RedisModuleCmdFunc timeout_callback, void (*free_privdata)(RedisModuleCtx*,void*), long long timeout_ms, RedisModuleString **keys, int numkeys, void *privdata, int flags) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API void (*RedisModule_SignalKeyAsReady)(RedisModuleCtx *ctx, RedisModuleString *key) REDISMODULE_ATTR;
|
REDISMODULE_API void (*RedisModule_SignalKeyAsReady)(RedisModuleCtx *ctx, RedisModuleString *key) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API RedisModuleString * (*RedisModule_GetBlockedClientReadyKey)(RedisModuleCtx *ctx) REDISMODULE_ATTR;
|
REDISMODULE_API RedisModuleString * (*RedisModule_GetBlockedClientReadyKey)(RedisModuleCtx *ctx) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API RedisModuleScanCursor * (*RedisModule_ScanCursorCreate)() REDISMODULE_ATTR;
|
REDISMODULE_API RedisModuleScanCursor * (*RedisModule_ScanCursorCreate)(void) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API void (*RedisModule_ScanCursorRestart)(RedisModuleScanCursor *cursor) REDISMODULE_ATTR;
|
REDISMODULE_API void (*RedisModule_ScanCursorRestart)(RedisModuleScanCursor *cursor) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API void (*RedisModule_ScanCursorDestroy)(RedisModuleScanCursor *cursor) REDISMODULE_ATTR;
|
REDISMODULE_API void (*RedisModule_ScanCursorDestroy)(RedisModuleScanCursor *cursor) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_Scan)(RedisModuleCtx *ctx, RedisModuleScanCursor *cursor, RedisModuleScanCB fn, void *privdata) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_Scan)(RedisModuleCtx *ctx, RedisModuleScanCursor *cursor, RedisModuleScanCB fn, void *privdata) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_ScanKey)(RedisModuleKey *key, RedisModuleScanCursor *cursor, RedisModuleScanKeyCB fn, void *privdata) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_ScanKey)(RedisModuleKey *key, RedisModuleScanCursor *cursor, RedisModuleScanKeyCB fn, void *privdata) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_GetContextFlagsAll)() REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_GetContextFlagsAll)(void) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_GetModuleOptionsAll)() REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_GetModuleOptionsAll)(void) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_GetKeyspaceNotificationFlagsAll)() REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_GetKeyspaceNotificationFlagsAll)(void) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_IsSubEventSupported)(RedisModuleEvent event, uint64_t subevent) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_IsSubEventSupported)(RedisModuleEvent event, uint64_t subevent) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_GetServerVersion)() REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_GetServerVersion)(void) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_GetTypeMethodVersion)() REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_GetTypeMethodVersion)(void) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API void (*RedisModule_Yield)(RedisModuleCtx *ctx, int flags, const char *busy_reply) REDISMODULE_ATTR;
|
REDISMODULE_API void (*RedisModule_Yield)(RedisModuleCtx *ctx, int flags, const char *busy_reply) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API RedisModuleBlockedClient * (*RedisModule_BlockClient)(RedisModuleCtx *ctx, RedisModuleCmdFunc reply_callback, RedisModuleCmdFunc timeout_callback, void (*free_privdata)(RedisModuleCtx*,void*), long long timeout_ms) REDISMODULE_ATTR;
|
REDISMODULE_API RedisModuleBlockedClient * (*RedisModule_BlockClient)(RedisModuleCtx *ctx, RedisModuleCmdFunc reply_callback, RedisModuleCmdFunc timeout_callback, void (*free_privdata)(RedisModuleCtx*,void*), long long timeout_ms) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API void * (*RedisModule_BlockClientGetPrivateData)(RedisModuleBlockedClient *blocked_client) REDISMODULE_ATTR;
|
REDISMODULE_API void * (*RedisModule_BlockClientGetPrivateData)(RedisModuleBlockedClient *blocked_client) REDISMODULE_ATTR;
|
||||||
|
@ -1234,7 +1234,7 @@ REDISMODULE_API void (*RedisModule_ThreadSafeContextUnlock)(RedisModuleCtx *ctx)
|
||||||
REDISMODULE_API int (*RedisModule_SubscribeToKeyspaceEvents)(RedisModuleCtx *ctx, int types, RedisModuleNotificationFunc cb) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_SubscribeToKeyspaceEvents)(RedisModuleCtx *ctx, int types, RedisModuleNotificationFunc cb) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_AddPostNotificationJob)(RedisModuleCtx *ctx, RedisModulePostNotificationJobFunc callback, void *pd, void (*free_pd)(void*)) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_AddPostNotificationJob)(RedisModuleCtx *ctx, RedisModulePostNotificationJobFunc callback, void *pd, void (*free_pd)(void*)) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_NotifyKeyspaceEvent)(RedisModuleCtx *ctx, int type, const char *event, RedisModuleString *key) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_NotifyKeyspaceEvent)(RedisModuleCtx *ctx, int type, const char *event, RedisModuleString *key) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_GetNotifyKeyspaceEvents)() REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_GetNotifyKeyspaceEvents)(void) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_BlockedClientDisconnected)(RedisModuleCtx *ctx) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_BlockedClientDisconnected)(RedisModuleCtx *ctx) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API void (*RedisModule_RegisterClusterMessageReceiver)(RedisModuleCtx *ctx, uint8_t type, RedisModuleClusterMessageReceiver callback) REDISMODULE_ATTR;
|
REDISMODULE_API void (*RedisModule_RegisterClusterMessageReceiver)(RedisModuleCtx *ctx, uint8_t type, RedisModuleClusterMessageReceiver callback) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_SendClusterMessage)(RedisModuleCtx *ctx, const char *target_id, uint8_t type, const char *msg, uint32_t len) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_SendClusterMessage)(RedisModuleCtx *ctx, const char *target_id, uint8_t type, const char *msg, uint32_t len) REDISMODULE_ATTR;
|
||||||
|
@ -1263,7 +1263,7 @@ REDISMODULE_API int (*RedisModule_Fork)(RedisModuleForkDoneHandler cb, void *use
|
||||||
REDISMODULE_API void (*RedisModule_SendChildHeartbeat)(double progress) REDISMODULE_ATTR;
|
REDISMODULE_API void (*RedisModule_SendChildHeartbeat)(double progress) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_ExitFromChild)(int retcode) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_ExitFromChild)(int retcode) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API int (*RedisModule_KillForkChild)(int child_pid) REDISMODULE_ATTR;
|
REDISMODULE_API int (*RedisModule_KillForkChild)(int child_pid) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API float (*RedisModule_GetUsedMemoryRatio)() REDISMODULE_ATTR;
|
REDISMODULE_API float (*RedisModule_GetUsedMemoryRatio)(void) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API size_t (*RedisModule_MallocSize)(void* ptr) REDISMODULE_ATTR;
|
REDISMODULE_API size_t (*RedisModule_MallocSize)(void* ptr) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API size_t (*RedisModule_MallocUsableSize)(void *ptr) REDISMODULE_ATTR;
|
REDISMODULE_API size_t (*RedisModule_MallocUsableSize)(void *ptr) REDISMODULE_ATTR;
|
||||||
REDISMODULE_API size_t (*RedisModule_MallocSizeString)(RedisModuleString* str) REDISMODULE_ATTR;
|
REDISMODULE_API size_t (*RedisModule_MallocSizeString)(RedisModuleString* str) REDISMODULE_ATTR;
|
||||||
|
|
|
@ -55,7 +55,7 @@ int cancelReplicationHandshake(int reconnect);
|
||||||
int RDBGeneratedByReplication = 0;
|
int RDBGeneratedByReplication = 0;
|
||||||
|
|
||||||
/* --------------------------- Utility functions ---------------------------- */
|
/* --------------------------- Utility functions ---------------------------- */
|
||||||
static ConnectionType *connTypeOfReplication() {
|
static ConnectionType *connTypeOfReplication(void) {
|
||||||
if (server.tls_replication) {
|
if (server.tls_replication) {
|
||||||
return connectionTypeTls();
|
return connectionTypeTls();
|
||||||
}
|
}
|
||||||
|
@ -1793,7 +1793,7 @@ void replicationCreateMasterClient(connection *conn, int dbid) {
|
||||||
* master-replica synchronization: if it fails after multiple attempts
|
* master-replica synchronization: if it fails after multiple attempts
|
||||||
* the replica cannot be considered reliable and exists with an
|
* the replica cannot be considered reliable and exists with an
|
||||||
* error. */
|
* error. */
|
||||||
void restartAOFAfterSYNC() {
|
void restartAOFAfterSYNC(void) {
|
||||||
unsigned int tries, max_tries = 10;
|
unsigned int tries, max_tries = 10;
|
||||||
for (tries = 0; tries < max_tries; ++tries) {
|
for (tries = 0; tries < max_tries; ++tries) {
|
||||||
if (startAppendOnly() == C_OK) break;
|
if (startAppendOnly() == C_OK) break;
|
||||||
|
@ -1810,7 +1810,7 @@ void restartAOFAfterSYNC() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int useDisklessLoad() {
|
static int useDisklessLoad(void) {
|
||||||
/* compute boolean decision to use diskless load */
|
/* compute boolean decision to use diskless load */
|
||||||
int enabled = server.repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB ||
|
int enabled = server.repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB ||
|
||||||
(server.repl_diskless_load == REPL_DISKLESS_LOAD_WHEN_DB_EMPTY && dbTotalServerKeyCount()==0);
|
(server.repl_diskless_load == REPL_DISKLESS_LOAD_WHEN_DB_EMPTY && dbTotalServerKeyCount()==0);
|
||||||
|
@ -1849,7 +1849,7 @@ void disklessLoadDiscardTempDb(redisDb *tempDb) {
|
||||||
* we have no way to incrementally feed our replicas after that.
|
* we have no way to incrementally feed our replicas after that.
|
||||||
* We want our replicas to resync with us as well, if we have any sub-replicas.
|
* We want our replicas to resync with us as well, if we have any sub-replicas.
|
||||||
* This is useful on readSyncBulkPayload in places where we just finished transferring db. */
|
* This is useful on readSyncBulkPayload in places where we just finished transferring db. */
|
||||||
void replicationAttachToNewMaster() {
|
void replicationAttachToNewMaster(void) {
|
||||||
/* Replica starts to apply data from new master, we must discard the cached
|
/* Replica starts to apply data from new master, we must discard the cached
|
||||||
* master structure. */
|
* master structure. */
|
||||||
serverAssert(server.master == NULL);
|
serverAssert(server.master == NULL);
|
||||||
|
@ -3993,7 +3993,7 @@ static client *findReplica(char *host, int port) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *getFailoverStateString() {
|
const char *getFailoverStateString(void) {
|
||||||
switch(server.failover_state) {
|
switch(server.failover_state) {
|
||||||
case NO_FAILOVER: return "no-failover";
|
case NO_FAILOVER: return "no-failover";
|
||||||
case FAILOVER_IN_PROGRESS: return "failover-in-progress";
|
case FAILOVER_IN_PROGRESS: return "failover-in-progress";
|
||||||
|
@ -4005,7 +4005,7 @@ const char *getFailoverStateString() {
|
||||||
/* Resets the internal failover configuration, this needs
|
/* Resets the internal failover configuration, this needs
|
||||||
* to be called after a failover either succeeds or fails
|
* to be called after a failover either succeeds or fails
|
||||||
* as it includes the client unpause. */
|
* as it includes the client unpause. */
|
||||||
void clearFailoverState() {
|
void clearFailoverState(void) {
|
||||||
server.failover_end_time = 0;
|
server.failover_end_time = 0;
|
||||||
server.force_failover = 0;
|
server.force_failover = 0;
|
||||||
zfree(server.target_replica_host);
|
zfree(server.target_replica_host);
|
||||||
|
|
14
src/script.c
14
src/script.c
|
@ -60,16 +60,16 @@ static void enterScriptTimedoutMode(scriptRunCtx *run_ctx) {
|
||||||
blockingOperationStarts();
|
blockingOperationStarts();
|
||||||
}
|
}
|
||||||
|
|
||||||
int scriptIsTimedout() {
|
int scriptIsTimedout(void) {
|
||||||
return scriptIsRunning() && (curr_run_ctx->flags & SCRIPT_TIMEDOUT);
|
return scriptIsRunning() && (curr_run_ctx->flags & SCRIPT_TIMEDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
client* scriptGetClient() {
|
client* scriptGetClient(void) {
|
||||||
serverAssert(scriptIsRunning());
|
serverAssert(scriptIsRunning());
|
||||||
return curr_run_ctx->c;
|
return curr_run_ctx->c;
|
||||||
}
|
}
|
||||||
|
|
||||||
client* scriptGetCaller() {
|
client* scriptGetCaller(void) {
|
||||||
serverAssert(scriptIsRunning());
|
serverAssert(scriptIsRunning());
|
||||||
return curr_run_ctx->original_client;
|
return curr_run_ctx->original_client;
|
||||||
}
|
}
|
||||||
|
@ -269,16 +269,16 @@ void scriptResetRun(scriptRunCtx *run_ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return true if a script is currently running */
|
/* return true if a script is currently running */
|
||||||
int scriptIsRunning() {
|
int scriptIsRunning(void) {
|
||||||
return curr_run_ctx != NULL;
|
return curr_run_ctx != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* scriptCurrFunction() {
|
const char* scriptCurrFunction(void) {
|
||||||
serverAssert(scriptIsRunning());
|
serverAssert(scriptIsRunning());
|
||||||
return curr_run_ctx->funcname;
|
return curr_run_ctx->funcname;
|
||||||
}
|
}
|
||||||
|
|
||||||
int scriptIsEval() {
|
int scriptIsEval(void) {
|
||||||
serverAssert(scriptIsRunning());
|
serverAssert(scriptIsRunning());
|
||||||
return curr_run_ctx->flags & SCRIPT_EVAL_MODE;
|
return curr_run_ctx->flags & SCRIPT_EVAL_MODE;
|
||||||
}
|
}
|
||||||
|
@ -571,7 +571,7 @@ error:
|
||||||
incrCommandStatsOnError(cmd, ERROR_COMMAND_REJECTED);
|
incrCommandStatsOnError(cmd, ERROR_COMMAND_REJECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
long long scriptRunDuration() {
|
long long scriptRunDuration(void) {
|
||||||
serverAssert(scriptIsRunning());
|
serverAssert(scriptIsRunning());
|
||||||
return elapsedMs(curr_run_ctx->start_time);
|
return elapsedMs(curr_run_ctx->start_time);
|
||||||
}
|
}
|
||||||
|
|
14
src/script.h
14
src/script.h
|
@ -100,12 +100,12 @@ int scriptSetRepl(scriptRunCtx *r_ctx, int repl);
|
||||||
void scriptCall(scriptRunCtx *r_ctx, sds *err);
|
void scriptCall(scriptRunCtx *r_ctx, sds *err);
|
||||||
int scriptInterrupt(scriptRunCtx *r_ctx);
|
int scriptInterrupt(scriptRunCtx *r_ctx);
|
||||||
void scriptKill(client *c, int is_eval);
|
void scriptKill(client *c, int is_eval);
|
||||||
int scriptIsRunning();
|
int scriptIsRunning(void);
|
||||||
const char* scriptCurrFunction();
|
const char* scriptCurrFunction(void);
|
||||||
int scriptIsEval();
|
int scriptIsEval(void);
|
||||||
int scriptIsTimedout();
|
int scriptIsTimedout(void);
|
||||||
client* scriptGetClient();
|
client* scriptGetClient(void);
|
||||||
client* scriptGetCaller();
|
client* scriptGetCaller(void);
|
||||||
long long scriptRunDuration();
|
long long scriptRunDuration(void);
|
||||||
|
|
||||||
#endif /* __SCRIPT_H_ */
|
#endif /* __SCRIPT_H_ */
|
||||||
|
|
|
@ -1740,7 +1740,7 @@ const char *sentinelCheckCreateInstanceErrors(int role) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init function for server.sentinel_config */
|
/* init function for server.sentinel_config */
|
||||||
void initializeSentinelConfig() {
|
void initializeSentinelConfig(void) {
|
||||||
server.sentinel_config = zmalloc(sizeof(struct sentinelConfig));
|
server.sentinel_config = zmalloc(sizeof(struct sentinelConfig));
|
||||||
server.sentinel_config->monitor_cfg = listCreate();
|
server.sentinel_config->monitor_cfg = listCreate();
|
||||||
server.sentinel_config->pre_monitor_cfg = listCreate();
|
server.sentinel_config->pre_monitor_cfg = listCreate();
|
||||||
|
@ -1751,7 +1751,7 @@ void initializeSentinelConfig() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* destroy function for server.sentinel_config */
|
/* destroy function for server.sentinel_config */
|
||||||
void freeSentinelConfig() {
|
void freeSentinelConfig(void) {
|
||||||
/* release these three config queues since we will not use it anymore */
|
/* release these three config queues since we will not use it anymore */
|
||||||
listRelease(server.sentinel_config->pre_monitor_cfg);
|
listRelease(server.sentinel_config->pre_monitor_cfg);
|
||||||
listRelease(server.sentinel_config->monitor_cfg);
|
listRelease(server.sentinel_config->monitor_cfg);
|
||||||
|
@ -3179,7 +3179,7 @@ void sentinelSendPeriodicCommands(sentinelRedisInstance *ri) {
|
||||||
|
|
||||||
/* =========================== SENTINEL command ============================= */
|
/* =========================== SENTINEL command ============================= */
|
||||||
|
|
||||||
const char* getLogLevel() {
|
const char* getLogLevel(void) {
|
||||||
switch (server.verbosity) {
|
switch (server.verbosity) {
|
||||||
case LL_DEBUG: return "debug";
|
case LL_DEBUG: return "debug";
|
||||||
case LL_VERBOSE: return "verbose";
|
case LL_VERBOSE: return "verbose";
|
||||||
|
|
30
src/server.c
30
src/server.c
|
@ -656,11 +656,11 @@ const char *strChildType(int type) {
|
||||||
|
|
||||||
/* Return true if there are active children processes doing RDB saving,
|
/* Return true if there are active children processes doing RDB saving,
|
||||||
* AOF rewriting, or some side process spawned by a loaded module. */
|
* AOF rewriting, or some side process spawned by a loaded module. */
|
||||||
int hasActiveChildProcess() {
|
int hasActiveChildProcess(void) {
|
||||||
return server.child_pid != -1;
|
return server.child_pid != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetChildState() {
|
void resetChildState(void) {
|
||||||
server.child_type = CHILD_TYPE_NONE;
|
server.child_type = CHILD_TYPE_NONE;
|
||||||
server.child_pid = -1;
|
server.child_pid = -1;
|
||||||
server.stat_current_cow_peak = 0;
|
server.stat_current_cow_peak = 0;
|
||||||
|
@ -682,7 +682,7 @@ int isMutuallyExclusiveChildType(int type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns true when we're inside a long command that yielded to the event loop. */
|
/* Returns true when we're inside a long command that yielded to the event loop. */
|
||||||
int isInsideYieldingLongCommand() {
|
int isInsideYieldingLongCommand(void) {
|
||||||
return scriptIsTimedout() || server.busy_module_yield_flags;
|
return scriptIsTimedout() || server.busy_module_yield_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1148,7 +1148,7 @@ void enterExecutionUnit(int update_cached_time, long long us) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void exitExecutionUnit() {
|
void exitExecutionUnit(void) {
|
||||||
--server.execution_nesting;
|
--server.execution_nesting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1204,7 +1204,7 @@ void checkChildrenDone(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called from serverCron and cronUpdateMemoryStats to update cached memory metrics. */
|
/* Called from serverCron and cronUpdateMemoryStats to update cached memory metrics. */
|
||||||
void cronUpdateMemoryStats() {
|
void cronUpdateMemoryStats(void) {
|
||||||
/* Record the max memory used since the server was started. */
|
/* Record the max memory used since the server was started. */
|
||||||
if (zmalloc_used_memory() > server.stat_peak_memory)
|
if (zmalloc_used_memory() > server.stat_peak_memory)
|
||||||
server.stat_peak_memory = zmalloc_used_memory();
|
server.stat_peak_memory = zmalloc_used_memory();
|
||||||
|
@ -1518,14 +1518,14 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void blockingOperationStarts() {
|
void blockingOperationStarts(void) {
|
||||||
if(!server.blocking_op_nesting++){
|
if(!server.blocking_op_nesting++){
|
||||||
updateCachedTime(0);
|
updateCachedTime(0);
|
||||||
server.blocked_last_cron = server.mstime;
|
server.blocked_last_cron = server.mstime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void blockingOperationEnds() {
|
void blockingOperationEnds(void) {
|
||||||
if(!(--server.blocking_op_nesting)){
|
if(!(--server.blocking_op_nesting)){
|
||||||
server.blocked_last_cron = 0;
|
server.blocked_last_cron = 0;
|
||||||
}
|
}
|
||||||
|
@ -1536,7 +1536,7 @@ void blockingOperationEnds() {
|
||||||
* It attempts to do its duties at a similar rate as the configured server.hz,
|
* It attempts to do its duties at a similar rate as the configured server.hz,
|
||||||
* and updates cronloops variable so that similarly to serverCron, the
|
* and updates cronloops variable so that similarly to serverCron, the
|
||||||
* run_with_period can be used. */
|
* run_with_period can be used. */
|
||||||
void whileBlockedCron() {
|
void whileBlockedCron(void) {
|
||||||
/* Here we may want to perform some cron jobs (normally done server.hz times
|
/* Here we may want to perform some cron jobs (normally done server.hz times
|
||||||
* per second). */
|
* per second). */
|
||||||
|
|
||||||
|
@ -1954,7 +1954,7 @@ void createSharedObjects(void) {
|
||||||
shared.maxstring = sdsnew("maxstring");
|
shared.maxstring = sdsnew("maxstring");
|
||||||
}
|
}
|
||||||
|
|
||||||
void initServerClientMemUsageBuckets() {
|
void initServerClientMemUsageBuckets(void) {
|
||||||
if (server.client_mem_usage_buckets)
|
if (server.client_mem_usage_buckets)
|
||||||
return;
|
return;
|
||||||
server.client_mem_usage_buckets = zmalloc(sizeof(clientMemUsageBucket)*CLIENT_MEM_USAGE_BUCKETS);
|
server.client_mem_usage_buckets = zmalloc(sizeof(clientMemUsageBucket)*CLIENT_MEM_USAGE_BUCKETS);
|
||||||
|
@ -1964,7 +1964,7 @@ void initServerClientMemUsageBuckets() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void freeServerClientMemUsageBuckets() {
|
void freeServerClientMemUsageBuckets(void) {
|
||||||
if (!server.client_mem_usage_buckets)
|
if (!server.client_mem_usage_buckets)
|
||||||
return;
|
return;
|
||||||
for (int j = 0; j < CLIENT_MEM_USAGE_BUCKETS; j++)
|
for (int j = 0; j < CLIENT_MEM_USAGE_BUCKETS; j++)
|
||||||
|
@ -2717,7 +2717,7 @@ void initServer(void) {
|
||||||
initServerClientMemUsageBuckets();
|
initServerClientMemUsageBuckets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initListeners() {
|
void initListeners(void) {
|
||||||
/* Setup listeners from server config for TCP/TLS/Unix */
|
/* Setup listeners from server config for TCP/TLS/Unix */
|
||||||
int conn_index;
|
int conn_index;
|
||||||
connListener *listener;
|
connListener *listener;
|
||||||
|
@ -2794,7 +2794,7 @@ void initListeners() {
|
||||||
* Specifically, creation of threads due to a race bug in ld.so, in which
|
* Specifically, creation of threads due to a race bug in ld.so, in which
|
||||||
* Thread Local Storage initialization collides with dlopen call.
|
* Thread Local Storage initialization collides with dlopen call.
|
||||||
* see: https://sourceware.org/bugzilla/show_bug.cgi?id=19329 */
|
* see: https://sourceware.org/bugzilla/show_bug.cgi?id=19329 */
|
||||||
void InitServerLast() {
|
void InitServerLast(void) {
|
||||||
bioInit();
|
bioInit();
|
||||||
initThreadedIO();
|
initThreadedIO();
|
||||||
set_jemalloc_bg_thread(server.jemalloc_bg_thread);
|
set_jemalloc_bg_thread(server.jemalloc_bg_thread);
|
||||||
|
@ -3304,7 +3304,7 @@ void updateCommandLatencyHistogram(struct hdr_histogram **latency_histogram, int
|
||||||
/* Handle the alsoPropagate() API to handle commands that want to propagate
|
/* Handle the alsoPropagate() API to handle commands that want to propagate
|
||||||
* multiple separated commands. Note that alsoPropagate() is not affected
|
* multiple separated commands. Note that alsoPropagate() is not affected
|
||||||
* by CLIENT_PREVENT_PROP flag. */
|
* by CLIENT_PREVENT_PROP flag. */
|
||||||
static void propagatePendingCommands() {
|
static void propagatePendingCommands(void) {
|
||||||
if (server.also_propagate.numops == 0)
|
if (server.also_propagate.numops == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -3360,7 +3360,7 @@ static void propagatePendingCommands() {
|
||||||
* currently with respect to replication and post jobs, but in the future there might
|
* currently with respect to replication and post jobs, but in the future there might
|
||||||
* be other considerations. So we basically want the `postUnitOperations` to trigger
|
* be other considerations. So we basically want the `postUnitOperations` to trigger
|
||||||
* after the entire chain finished. */
|
* after the entire chain finished. */
|
||||||
void postExecutionUnitOperations() {
|
void postExecutionUnitOperations(void) {
|
||||||
if (server.execution_nesting)
|
if (server.execution_nesting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -6505,7 +6505,7 @@ void setupChildSignalHandlers(void) {
|
||||||
* of the parent process, e.g. fd(socket or flock) etc.
|
* of the parent process, e.g. fd(socket or flock) etc.
|
||||||
* should close the resources not used by the child process, so that if the
|
* should close the resources not used by the child process, so that if the
|
||||||
* parent restarts it can bind/lock despite the child possibly still running. */
|
* parent restarts it can bind/lock despite the child possibly still running. */
|
||||||
void closeChildUnusedResourceAfterFork() {
|
void closeChildUnusedResourceAfterFork(void) {
|
||||||
closeListeningSockets(0);
|
closeListeningSockets(0);
|
||||||
if (server.cluster_enabled && server.cluster_config_file_lock_fd != -1)
|
if (server.cluster_enabled && server.cluster_config_file_lock_fd != -1)
|
||||||
close(server.cluster_config_file_lock_fd); /* don't care if this fails */
|
close(server.cluster_config_file_lock_fd); /* don't care if this fails */
|
||||||
|
|
69
src/server.h
69
src/server.h
|
@ -1372,9 +1372,8 @@ typedef struct redisOp {
|
||||||
/* Defines an array of Redis operations. There is an API to add to this
|
/* Defines an array of Redis operations. There is an API to add to this
|
||||||
* structure in an easy way.
|
* structure in an easy way.
|
||||||
*
|
*
|
||||||
* redisOpArrayInit();
|
* int redisOpArrayAppend(redisOpArray *oa, int dbid, robj **argv, int argc, int target);
|
||||||
* redisOpArrayAppend();
|
* void redisOpArrayFree(redisOpArray *oa);
|
||||||
* redisOpArrayFree();
|
|
||||||
*/
|
*/
|
||||||
typedef struct redisOpArray {
|
typedef struct redisOpArray {
|
||||||
redisOp *ops;
|
redisOp *ops;
|
||||||
|
@ -2472,14 +2471,14 @@ void moduleAcquireGIL(void);
|
||||||
int moduleTryAcquireGIL(void);
|
int moduleTryAcquireGIL(void);
|
||||||
void moduleReleaseGIL(void);
|
void moduleReleaseGIL(void);
|
||||||
void moduleNotifyKeyspaceEvent(int type, const char *event, robj *key, int dbid);
|
void moduleNotifyKeyspaceEvent(int type, const char *event, robj *key, int dbid);
|
||||||
void firePostExecutionUnitJobs();
|
void firePostExecutionUnitJobs(void);
|
||||||
void moduleCallCommandFilters(client *c);
|
void moduleCallCommandFilters(client *c);
|
||||||
void modulePostExecutionUnitOperations();
|
void modulePostExecutionUnitOperations(void);
|
||||||
void ModuleForkDoneHandler(int exitcode, int bysignal);
|
void ModuleForkDoneHandler(int exitcode, int bysignal);
|
||||||
int TerminateModuleForkChild(int child_pid, int wait);
|
int TerminateModuleForkChild(int child_pid, int wait);
|
||||||
ssize_t rdbSaveModulesAux(rio *rdb, int when);
|
ssize_t rdbSaveModulesAux(rio *rdb, int when);
|
||||||
int moduleAllDatatypesHandleErrors();
|
int moduleAllDatatypesHandleErrors(void);
|
||||||
int moduleAllModulesHandleReplAsyncLoad();
|
int moduleAllModulesHandleReplAsyncLoad(void);
|
||||||
sds modulesCollectInfo(sds info, dict *sections_dict, int for_crash_report, int sections);
|
sds modulesCollectInfo(sds info, dict *sections_dict, int for_crash_report, int sections);
|
||||||
void moduleFireServerEvent(uint64_t eid, int subid, void *data);
|
void moduleFireServerEvent(uint64_t eid, int subid, void *data);
|
||||||
void processModuleLoadingProgressEvent(int is_aof);
|
void processModuleLoadingProgressEvent(int is_aof);
|
||||||
|
@ -2607,11 +2606,11 @@ void unpauseActions(pause_purpose purpose);
|
||||||
uint32_t isPausedActions(uint32_t action_bitmask);
|
uint32_t isPausedActions(uint32_t action_bitmask);
|
||||||
uint32_t isPausedActionsWithUpdate(uint32_t action_bitmask);
|
uint32_t isPausedActionsWithUpdate(uint32_t action_bitmask);
|
||||||
void updatePausedActions(void);
|
void updatePausedActions(void);
|
||||||
void unblockPostponedClients();
|
void unblockPostponedClients(void);
|
||||||
void processEventsWhileBlocked(void);
|
void processEventsWhileBlocked(void);
|
||||||
void whileBlockedCron();
|
void whileBlockedCron(void);
|
||||||
void blockingOperationStarts();
|
void blockingOperationStarts(void);
|
||||||
void blockingOperationEnds();
|
void blockingOperationEnds(void);
|
||||||
int handleClientsWithPendingWrites(void);
|
int handleClientsWithPendingWrites(void);
|
||||||
int handleClientsWithPendingWritesUsingThreads(void);
|
int handleClientsWithPendingWritesUsingThreads(void);
|
||||||
int handleClientsWithPendingReadsUsingThreads(void);
|
int handleClientsWithPendingReadsUsingThreads(void);
|
||||||
|
@ -2777,7 +2776,7 @@ void replicationCron(void);
|
||||||
void replicationStartPendingFork(void);
|
void replicationStartPendingFork(void);
|
||||||
void replicationHandleMasterDisconnection(void);
|
void replicationHandleMasterDisconnection(void);
|
||||||
void replicationCacheMaster(client *c);
|
void replicationCacheMaster(client *c);
|
||||||
void resizeReplicationBacklog();
|
void resizeReplicationBacklog(void);
|
||||||
void replicationSetMaster(char *ip, int port);
|
void replicationSetMaster(char *ip, int port);
|
||||||
void replicationUnsetMaster(void);
|
void replicationUnsetMaster(void);
|
||||||
void refreshGoodSlavesCount(void);
|
void refreshGoodSlavesCount(void);
|
||||||
|
@ -2806,7 +2805,7 @@ void rdbPipeWriteHandlerConnRemoved(struct connection *conn);
|
||||||
void clearFailoverState(void);
|
void clearFailoverState(void);
|
||||||
void updateFailoverStatus(void);
|
void updateFailoverStatus(void);
|
||||||
void abortFailover(const char *err);
|
void abortFailover(const char *err);
|
||||||
const char *getFailoverStateString();
|
const char *getFailoverStateString(void);
|
||||||
|
|
||||||
/* Generic persistence functions */
|
/* Generic persistence functions */
|
||||||
void startLoadingFile(size_t size, char* filename, int rdbflags);
|
void startLoadingFile(size_t size, char* filename, int rdbflags);
|
||||||
|
@ -2840,7 +2839,7 @@ void stopAppendOnly(void);
|
||||||
int startAppendOnly(void);
|
int startAppendOnly(void);
|
||||||
void backgroundRewriteDoneHandler(int exitcode, int bysignal);
|
void backgroundRewriteDoneHandler(int exitcode, int bysignal);
|
||||||
void killAppendOnlyChild(void);
|
void killAppendOnlyChild(void);
|
||||||
void restartAOFAfterSYNC();
|
void restartAOFAfterSYNC(void);
|
||||||
void aofLoadManifestFromDisk(void);
|
void aofLoadManifestFromDisk(void);
|
||||||
void aofOpenIfNeededOnServerStart(void);
|
void aofOpenIfNeededOnServerStart(void);
|
||||||
void aofManifestFree(aofManifest *am);
|
void aofManifestFree(aofManifest *am);
|
||||||
|
@ -2857,8 +2856,8 @@ void receiveChildInfo(void);
|
||||||
|
|
||||||
/* Fork helpers */
|
/* Fork helpers */
|
||||||
int redisFork(int purpose);
|
int redisFork(int purpose);
|
||||||
int hasActiveChildProcess();
|
int hasActiveChildProcess(void);
|
||||||
void resetChildState();
|
void resetChildState(void);
|
||||||
int isMutuallyExclusiveChildType(int type);
|
int isMutuallyExclusiveChildType(int type);
|
||||||
|
|
||||||
/* acl.c -- Authentication related prototypes. */
|
/* acl.c -- Authentication related prototypes. */
|
||||||
|
@ -2912,13 +2911,13 @@ int ACLLoadConfiguredUsers(void);
|
||||||
robj *ACLDescribeUser(user *u);
|
robj *ACLDescribeUser(user *u);
|
||||||
void ACLLoadUsersAtStartup(void);
|
void ACLLoadUsersAtStartup(void);
|
||||||
void addReplyCommandCategories(client *c, struct redisCommand *cmd);
|
void addReplyCommandCategories(client *c, struct redisCommand *cmd);
|
||||||
user *ACLCreateUnlinkedUser();
|
user *ACLCreateUnlinkedUser(void);
|
||||||
void ACLFreeUserAndKillClients(user *u);
|
void ACLFreeUserAndKillClients(user *u);
|
||||||
void addACLLogEntry(client *c, int reason, int context, int argpos, sds username, sds object);
|
void addACLLogEntry(client *c, int reason, int context, int argpos, sds username, sds object);
|
||||||
sds getAclErrorMessage(int acl_res, user *user, struct redisCommand *cmd, sds errored_val, int verbose);
|
sds getAclErrorMessage(int acl_res, user *user, struct redisCommand *cmd, sds errored_val, int verbose);
|
||||||
void ACLUpdateDefaultUserPassword(sds password);
|
void ACLUpdateDefaultUserPassword(sds password);
|
||||||
sds genRedisInfoStringACLStats(sds info);
|
sds genRedisInfoStringACLStats(sds info);
|
||||||
void ACLRecomputeCommandBitsFromCommandRulesAllUsers();
|
void ACLRecomputeCommandBitsFromCommandRulesAllUsers(void);
|
||||||
|
|
||||||
/* Sorted sets data type */
|
/* Sorted sets data type */
|
||||||
|
|
||||||
|
@ -2990,7 +2989,7 @@ int zslLexValueLteMax(sds value, zlexrangespec *spec);
|
||||||
|
|
||||||
/* Core functions */
|
/* Core functions */
|
||||||
int getMaxmemoryState(size_t *total, size_t *logical, size_t *tofree, float *level);
|
int getMaxmemoryState(size_t *total, size_t *logical, size_t *tofree, float *level);
|
||||||
size_t freeMemoryGetNotCountedMemory();
|
size_t freeMemoryGetNotCountedMemory(void);
|
||||||
int overMaxmemoryAfterAlloc(size_t moremem);
|
int overMaxmemoryAfterAlloc(size_t moremem);
|
||||||
uint64_t getCommandFlags(client *c);
|
uint64_t getCommandFlags(client *c);
|
||||||
int processCommand(client *c);
|
int processCommand(client *c);
|
||||||
|
@ -3011,11 +3010,11 @@ struct redisCommand *lookupCommandByCString(const char *s);
|
||||||
struct redisCommand *lookupCommandOrOriginal(robj **argv, int argc);
|
struct redisCommand *lookupCommandOrOriginal(robj **argv, int argc);
|
||||||
int commandCheckExistence(client *c, sds *err);
|
int commandCheckExistence(client *c, sds *err);
|
||||||
int commandCheckArity(client *c, sds *err);
|
int commandCheckArity(client *c, sds *err);
|
||||||
void startCommandExecution();
|
void startCommandExecution(void);
|
||||||
int incrCommandStatsOnError(struct redisCommand *cmd, int flags);
|
int incrCommandStatsOnError(struct redisCommand *cmd, int flags);
|
||||||
void call(client *c, int flags);
|
void call(client *c, int flags);
|
||||||
void alsoPropagate(int dbid, robj **argv, int argc, int target);
|
void alsoPropagate(int dbid, robj **argv, int argc, int target);
|
||||||
void postExecutionUnitOperations();
|
void postExecutionUnitOperations(void);
|
||||||
void redisOpArrayFree(redisOpArray *oa);
|
void redisOpArrayFree(redisOpArray *oa);
|
||||||
void forceCommandPropagation(client *c, int flags);
|
void forceCommandPropagation(client *c, int flags);
|
||||||
void preventCommandPropagation(client *c);
|
void preventCommandPropagation(client *c);
|
||||||
|
@ -3047,7 +3046,7 @@ void incrementErrorCount(const char *fullerr, size_t namelen);
|
||||||
void closeListeningSockets(int unlink_unix_socket);
|
void closeListeningSockets(int unlink_unix_socket);
|
||||||
void updateCachedTime(int update_daylight_info);
|
void updateCachedTime(int update_daylight_info);
|
||||||
void enterExecutionUnit(int update_cached_time, long long us);
|
void enterExecutionUnit(int update_cached_time, long long us);
|
||||||
void exitExecutionUnit();
|
void exitExecutionUnit(void);
|
||||||
void resetServerStats(void);
|
void resetServerStats(void);
|
||||||
void activeDefragCycle(void);
|
void activeDefragCycle(void);
|
||||||
unsigned int getLRUClock(void);
|
unsigned int getLRUClock(void);
|
||||||
|
@ -3121,8 +3120,8 @@ int pubsubUnsubscribeAllPatterns(client *c, int notify);
|
||||||
int pubsubPublishMessage(robj *channel, robj *message, int sharded);
|
int pubsubPublishMessage(robj *channel, robj *message, int sharded);
|
||||||
int pubsubPublishMessageAndPropagateToCluster(robj *channel, robj *message, int sharded);
|
int pubsubPublishMessageAndPropagateToCluster(robj *channel, robj *message, int sharded);
|
||||||
void addReplyPubsubMessage(client *c, robj *channel, robj *msg, robj *message_bulk);
|
void addReplyPubsubMessage(client *c, robj *channel, robj *msg, robj *message_bulk);
|
||||||
int serverPubsubSubscriptionCount();
|
int serverPubsubSubscriptionCount(void);
|
||||||
int serverPubsubShardSubscriptionCount();
|
int serverPubsubShardSubscriptionCount(void);
|
||||||
size_t pubsubMemOverhead(client *c);
|
size_t pubsubMemOverhead(client *c);
|
||||||
|
|
||||||
/* Keyspace events notification */
|
/* Keyspace events notification */
|
||||||
|
@ -3176,12 +3175,12 @@ struct rewriteConfigState; /* Forward declaration to export API. */
|
||||||
int rewriteConfigRewriteLine(struct rewriteConfigState *state, const char *option, sds line, int force);
|
int rewriteConfigRewriteLine(struct rewriteConfigState *state, const char *option, sds line, int force);
|
||||||
void rewriteConfigMarkAsProcessed(struct rewriteConfigState *state, const char *option);
|
void rewriteConfigMarkAsProcessed(struct rewriteConfigState *state, const char *option);
|
||||||
int rewriteConfig(char *path, int force_write);
|
int rewriteConfig(char *path, int force_write);
|
||||||
void initConfigValues();
|
void initConfigValues(void);
|
||||||
void removeConfig(sds name);
|
void removeConfig(sds name);
|
||||||
sds getConfigDebugInfo();
|
sds getConfigDebugInfo(void);
|
||||||
int allowProtectedAction(int config, client *c);
|
int allowProtectedAction(int config, client *c);
|
||||||
void initServerClientMemUsageBuckets();
|
void initServerClientMemUsageBuckets(void);
|
||||||
void freeServerClientMemUsageBuckets();
|
void freeServerClientMemUsageBuckets(void);
|
||||||
|
|
||||||
/* Module Configuration */
|
/* Module Configuration */
|
||||||
typedef struct ModuleConfig ModuleConfig;
|
typedef struct ModuleConfig ModuleConfig;
|
||||||
|
@ -3249,7 +3248,7 @@ robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o);
|
||||||
long long emptyData(int dbnum, int flags, void(callback)(dict*));
|
long long emptyData(int dbnum, int flags, void(callback)(dict*));
|
||||||
long long emptyDbStructure(redisDb *dbarray, int dbnum, int async, void(callback)(dict*));
|
long long emptyDbStructure(redisDb *dbarray, int dbnum, int async, void(callback)(dict*));
|
||||||
void flushAllDataAndResetRDB(int flags);
|
void flushAllDataAndResetRDB(int flags);
|
||||||
long long dbTotalServerKeyCount();
|
long long dbTotalServerKeyCount(void);
|
||||||
redisDb *initTempDb(void);
|
redisDb *initTempDb(void);
|
||||||
void discardTempDb(redisDb *tempDb, void(callback)(dict*));
|
void discardTempDb(redisDb *tempDb, void(callback)(dict*));
|
||||||
|
|
||||||
|
@ -3326,16 +3325,16 @@ sds luaCreateFunction(client *c, robj *body);
|
||||||
void luaLdbLineHook(lua_State *lua, lua_Debug *ar);
|
void luaLdbLineHook(lua_State *lua, lua_Debug *ar);
|
||||||
void freeLuaScriptsAsync(dict *lua_scripts);
|
void freeLuaScriptsAsync(dict *lua_scripts);
|
||||||
void freeFunctionsAsync(functionsLibCtx *lib_ctx);
|
void freeFunctionsAsync(functionsLibCtx *lib_ctx);
|
||||||
int ldbIsEnabled();
|
int ldbIsEnabled(void);
|
||||||
void ldbLog(sds entry);
|
void ldbLog(sds entry);
|
||||||
void ldbLogRedisReply(char *reply);
|
void ldbLogRedisReply(char *reply);
|
||||||
void sha1hex(char *digest, char *script, size_t len);
|
void sha1hex(char *digest, char *script, size_t len);
|
||||||
unsigned long evalMemory();
|
unsigned long evalMemory(void);
|
||||||
dict* evalScriptsDict();
|
dict* evalScriptsDict(void);
|
||||||
unsigned long evalScriptsMemory();
|
unsigned long evalScriptsMemory(void);
|
||||||
uint64_t evalGetCommandFlags(client *c, uint64_t orig_flags);
|
uint64_t evalGetCommandFlags(client *c, uint64_t orig_flags);
|
||||||
uint64_t fcallGetCommandFlags(client *c, uint64_t orig_flags);
|
uint64_t fcallGetCommandFlags(client *c, uint64_t orig_flags);
|
||||||
int isInsideYieldingLongCommand();
|
int isInsideYieldingLongCommand(void);
|
||||||
|
|
||||||
typedef struct luaScript {
|
typedef struct luaScript {
|
||||||
uint64_t flags;
|
uint64_t flags;
|
||||||
|
@ -3691,7 +3690,7 @@ dict *genInfoSectionDict(robj **argv, int argc, char **defaults, int *out_all, i
|
||||||
void releaseInfoSectionDict(dict *sec);
|
void releaseInfoSectionDict(dict *sec);
|
||||||
sds genRedisInfoString(dict *section_dict, int all_sections, int everything);
|
sds genRedisInfoString(dict *section_dict, int all_sections, int everything);
|
||||||
sds genModulesInfoString(sds info);
|
sds genModulesInfoString(sds info);
|
||||||
void applyWatchdogPeriod();
|
void applyWatchdogPeriod(void);
|
||||||
void watchdogScheduleSignal(int period);
|
void watchdogScheduleSignal(int period);
|
||||||
void serverLogHexDump(int level, char *descr, void *value, size_t len);
|
void serverLogHexDump(int level, char *descr, void *value, size_t len);
|
||||||
int memtest_preserving_test(unsigned long *m, size_t bytes, int passes);
|
int memtest_preserving_test(unsigned long *m, size_t bytes, int passes);
|
||||||
|
|
|
@ -464,7 +464,7 @@ int connRecvTimeout(connection *conn, long long ms) {
|
||||||
return anetRecvTimeout(NULL, conn->fd, ms);
|
return anetRecvTimeout(NULL, conn->fd, ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RedisRegisterConnectionTypeSocket()
|
int RedisRegisterConnectionTypeSocket(void)
|
||||||
{
|
{
|
||||||
return connTypeRegister(&CT_Socket);
|
return connTypeRegister(&CT_Socket);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1062,13 +1062,13 @@ static const char *connTLSGetType(connection *conn_) {
|
||||||
return CONN_TYPE_TLS;
|
return CONN_TYPE_TLS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tlsHasPendingData() {
|
static int tlsHasPendingData(void) {
|
||||||
if (!pending_list)
|
if (!pending_list)
|
||||||
return 0;
|
return 0;
|
||||||
return listLength(pending_list) > 0;
|
return listLength(pending_list) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tlsProcessPendingData() {
|
static int tlsProcessPendingData(void) {
|
||||||
listIter li;
|
listIter li;
|
||||||
listNode *ln;
|
listNode *ln;
|
||||||
|
|
||||||
|
@ -1151,13 +1151,13 @@ static ConnectionType CT_TLS = {
|
||||||
.get_peer_cert = connTLSGetPeerCert,
|
.get_peer_cert = connTLSGetPeerCert,
|
||||||
};
|
};
|
||||||
|
|
||||||
int RedisRegisterConnectionTypeTLS() {
|
int RedisRegisterConnectionTypeTLS(void) {
|
||||||
return connTypeRegister(&CT_TLS);
|
return connTypeRegister(&CT_TLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* USE_OPENSSL */
|
#else /* USE_OPENSSL */
|
||||||
|
|
||||||
int RedisRegisterConnectionTypeTLS() {
|
int RedisRegisterConnectionTypeTLS(void) {
|
||||||
serverLog(LL_VERBOSE, "Connection type %s not builtin", CONN_TYPE_TLS);
|
serverLog(LL_VERBOSE, "Connection type %s not builtin", CONN_TYPE_TLS);
|
||||||
return C_ERR;
|
return C_ERR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ static ConnectionType CT_Unix = {
|
||||||
.process_pending_data = NULL,
|
.process_pending_data = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
int RedisRegisterConnectionTypeUnix()
|
int RedisRegisterConnectionTypeUnix(void)
|
||||||
{
|
{
|
||||||
return connTypeRegister(&CT_Unix);
|
return connTypeRegister(&CT_Unix);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1694,7 +1694,7 @@ unsigned int ziplistRandomPairsUnique(unsigned char *zl, unsigned int count, zip
|
||||||
|
|
||||||
#define debug(f, ...) { if (DEBUG) printf(f, __VA_ARGS__); }
|
#define debug(f, ...) { if (DEBUG) printf(f, __VA_ARGS__); }
|
||||||
|
|
||||||
static unsigned char *createList() {
|
static unsigned char *createList(void) {
|
||||||
unsigned char *zl = ziplistNew();
|
unsigned char *zl = ziplistNew();
|
||||||
zl = ziplistPush(zl, (unsigned char*)"foo", 3, ZIPLIST_TAIL);
|
zl = ziplistPush(zl, (unsigned char*)"foo", 3, ZIPLIST_TAIL);
|
||||||
zl = ziplistPush(zl, (unsigned char*)"quux", 4, ZIPLIST_TAIL);
|
zl = ziplistPush(zl, (unsigned char*)"quux", 4, ZIPLIST_TAIL);
|
||||||
|
@ -1703,7 +1703,7 @@ static unsigned char *createList() {
|
||||||
return zl;
|
return zl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char *createIntList() {
|
static unsigned char *createIntList(void) {
|
||||||
unsigned char *zl = ziplistNew();
|
unsigned char *zl = ziplistNew();
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
|
|
|
@ -656,7 +656,7 @@ void set_jemalloc_bg_thread(int enable) {
|
||||||
je_mallctl("background_thread", NULL, 0, &val, 1);
|
je_mallctl("background_thread", NULL, 0, &val, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int jemalloc_purge() {
|
int jemalloc_purge(void) {
|
||||||
/* return all unused (reserved) pages to the OS */
|
/* return all unused (reserved) pages to the OS */
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
unsigned narenas = 0;
|
unsigned narenas = 0;
|
||||||
|
@ -682,7 +682,7 @@ void set_jemalloc_bg_thread(int enable) {
|
||||||
((void)(enable));
|
((void)(enable));
|
||||||
}
|
}
|
||||||
|
|
||||||
int jemalloc_purge() {
|
int jemalloc_purge(void) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ void zmalloc_set_oom_handler(void (*oom_handler)(size_t));
|
||||||
size_t zmalloc_get_rss(void);
|
size_t zmalloc_get_rss(void);
|
||||||
int zmalloc_get_allocator_info(size_t *allocated, size_t *active, size_t *resident);
|
int zmalloc_get_allocator_info(size_t *allocated, size_t *active, size_t *resident);
|
||||||
void set_jemalloc_bg_thread(int enable);
|
void set_jemalloc_bg_thread(int enable);
|
||||||
int jemalloc_purge();
|
int jemalloc_purge(void);
|
||||||
size_t zmalloc_get_private_dirty(long pid);
|
size_t zmalloc_get_private_dirty(long pid);
|
||||||
size_t zmalloc_get_smap_bytes_by_field(char *field, long pid);
|
size_t zmalloc_get_smap_bytes_by_field(char *field, long pid);
|
||||||
size_t zmalloc_get_memory_size(void);
|
size_t zmalloc_get_memory_size(void);
|
||||||
|
|
|
@ -21,7 +21,7 @@ typedef struct {
|
||||||
|
|
||||||
static RedisModuleType *fsltype = NULL;
|
static RedisModuleType *fsltype = NULL;
|
||||||
|
|
||||||
fsl_t *fsl_type_create() {
|
fsl_t *fsl_type_create(void) {
|
||||||
fsl_t *o;
|
fsl_t *o;
|
||||||
o = RedisModule_Alloc(sizeof(*o));
|
o = RedisModule_Alloc(sizeof(*o));
|
||||||
o->length = 0;
|
o->length = 0;
|
||||||
|
|
Loading…
Reference in New Issue