Added a server.arch_bits field instead of computing it at runtime for INFO.

This commit is contained in:
antirez 2012-02-02 10:02:40 +01:00
parent b80b1c5914
commit 75eaac5c74
2 changed files with 4 additions and 2 deletions

View File

@ -860,6 +860,7 @@ void createSharedObjects(void) {
} }
void initServerConfig() { void initServerConfig() {
server.arch_bits = (sizeof(long) == 8) ? 64 : 32;
server.port = REDIS_SERVERPORT; server.port = REDIS_SERVERPORT;
server.bindaddr = NULL; server.bindaddr = NULL;
server.unixsocket = NULL; server.unixsocket = NULL;
@ -1439,7 +1440,7 @@ sds genRedisInfoString(char *section) {
"redis_version:%s\r\n" "redis_version:%s\r\n"
"redis_git_sha1:%s\r\n" "redis_git_sha1:%s\r\n"
"redis_git_dirty:%d\r\n" "redis_git_dirty:%d\r\n"
"arch_bits:%s\r\n" "arch_bits:%d\r\n"
"multiplexing_api:%s\r\n" "multiplexing_api:%s\r\n"
"gcc_version:%d.%d.%d\r\n" "gcc_version:%d.%d.%d\r\n"
"process_id:%ld\r\n" "process_id:%ld\r\n"
@ -1450,7 +1451,7 @@ sds genRedisInfoString(char *section) {
REDIS_VERSION, REDIS_VERSION,
redisGitSHA1(), redisGitSHA1(),
strtol(redisGitDirty(),NULL,10) > 0, strtol(redisGitDirty(),NULL,10) > 0,
(sizeof(long) == 8) ? "64" : "32", server.arch_bits,
aeGetApiName(), aeGetApiName(),
#ifdef __GNUC__ #ifdef __GNUC__
__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__, __GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__,

View File

@ -527,6 +527,7 @@ struct redisServer {
int activerehashing; /* Incremental rehash in serverCron() */ int activerehashing; /* Incremental rehash in serverCron() */
char *requirepass; /* Pass for AUTH command, or NULL */ char *requirepass; /* Pass for AUTH command, or NULL */
char *pidfile; /* PID file path */ char *pidfile; /* PID file path */
int arch_bits; /* 32 or 64 depending on sizeof(long) */
/* Networking */ /* Networking */
int port; /* TCP listening port */ int port; /* TCP listening port */
char *bindaddr; /* Bind address or NULL */ char *bindaddr; /* Bind address or NULL */