X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/3b5e72d402345507856b00bb67a91942f4f1a49d..e1a586ee69a15dd15afbba8e25f8eb62bbb22da9:/src/config.c diff --git a/src/config.c b/src/config.c index 772ac764..a45acdb7 100644 --- a/src/config.c +++ b/src/config.c @@ -114,6 +114,46 @@ void loadServerConfig(char *filename) { } fclose(logfp); } + } else if (!strcasecmp(argv[0],"syslog-enabled") && argc == 2) { + if ((server.syslog_enabled = yesnotoi(argv[1])) == -1) { + err = "argument must be 'yes' or 'no'"; goto loaderr; + } + } else if (!strcasecmp(argv[0],"syslog-ident") && argc == 2) { + if (server.syslog_ident) zfree(server.syslog_ident); + server.syslog_ident = zstrdup(argv[1]); + } else if (!strcasecmp(argv[0],"syslog-facility") && argc == 2) { + struct { + const char *name; + const int value; + } validSyslogFacilities[] = { + {"user", LOG_USER}, + {"local0", LOG_LOCAL0}, + {"local1", LOG_LOCAL1}, + {"local2", LOG_LOCAL2}, + {"local3", LOG_LOCAL3}, + {"local4", LOG_LOCAL4}, + {"local5", LOG_LOCAL5}, + {"local6", LOG_LOCAL6}, + {"local7", LOG_LOCAL7}, + {NULL, 0} + }; + int i; + + for (i = 0; validSyslogFacilities[i].name; i++) { + if (!strcasecmp(validSyslogFacilities[i].name, argv[1])) { + server.syslog_facility = validSyslogFacilities[i].value; + break; + } + } + + if (!validSyslogFacilities[i].name) { + err = "Invalid log facility. Must be one of USER or between LOCAL0-LOCAL7"; + goto loaderr; + } + } else if (!strcasecmp(argv[0],"syslog-ident") && argc == 2) { + + + server.syslog_ident = zstrdup(argv[1]); } else if (!strcasecmp(argv[0],"databases") && argc == 2) { server.dbnum = atoi(argv[1]); if (server.dbnum < 1) { @@ -136,6 +176,8 @@ void loadServerConfig(char *filename) { server.maxmemory_policy = REDIS_MAXMEMORY_ALLKEYS_LRU; } else if (!strcasecmp(argv[1],"allkeys-random")) { server.maxmemory_policy = REDIS_MAXMEMORY_ALLKEYS_RANDOM; + } else if (!strcasecmp(argv[1],"noeviction")) { + server.maxmemory_policy = REDIS_MAXMEMORY_NO_EVICTION; } else { err = "Invalid maxmemory policy"; goto loaderr; @@ -307,6 +349,8 @@ void configSetCommand(redisClient *c) { server.maxmemory_policy = REDIS_MAXMEMORY_ALLKEYS_LRU; } else if (!strcasecmp(o->ptr,"allkeys-random")) { server.maxmemory_policy = REDIS_MAXMEMORY_ALLKEYS_RANDOM; + } else if (!strcasecmp(o->ptr,"noeviction")) { + server.maxmemory_policy = REDIS_MAXMEMORY_NO_EVICTION; } else { goto badfmt; } @@ -440,6 +484,7 @@ void configGetCommand(redisClient *c) { case REDIS_MAXMEMORY_VOLATILE_RANDOM: s = "volatile-random"; break; case REDIS_MAXMEMORY_ALLKEYS_LRU: s = "allkeys-lru"; break; case REDIS_MAXMEMORY_ALLKEYS_RANDOM: s = "allkeys-random"; break; + case REDIS_MAXMEMORY_NO_EVICTION: s = "noeviction"; break; default: s = "unknown"; break; /* too harmless to panic */ } addReplyBulkCString(c,"maxmemory-policy");