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 29b3794231
commit f373061563
2 changed files with 4 additions and 2 deletions

View File

@ -798,6 +798,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;
@ -1257,7 +1258,7 @@ sds genRedisInfoString(void) {
"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"
@ -1300,7 +1301,7 @@ sds genRedisInfoString(void) {
,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

@ -381,6 +381,7 @@ struct sharedObjectsStruct {
/* Global server state structure */ /* Global server state structure */
struct redisServer { struct redisServer {
pthread_t mainthread; pthread_t mainthread;
int arch_bits;
int port; int port;
char *bindaddr; char *bindaddr;
char *unixsocket; char *unixsocket;