From: Brian Aker Date: Thu, 14 Jan 2010 06:35:31 +0000 (-0800) Subject: Sign fix for variable (this should solve the solaris warning). X-Git-Tag: 0.40~113 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=e110b4a534fd2d052461777411dac53b40c165bf;p=awesomized%2Flibmemcached Sign fix for variable (this should solve the solaris warning). --- diff --git a/clients/memslap.c b/clients/memslap.c index efda8aff..88a0f21c 100644 --- a/clients/memslap.c +++ b/clients/memslap.c @@ -431,7 +431,7 @@ static void ms_options_parse(int argc, char *argv[]) break; case OPT_CONCURRENCY: /* --concurrency or -c */ - ms_setting.nconns= (int)strtol(optarg, (char **) NULL, 10); + ms_setting.nconns= (uint32_t)strtoul(optarg, (char **) NULL, 10); if (ms_setting.nconns <= 0) { fprintf(stderr, "Concurrency must be greater than 0.:-)\n"); @@ -640,7 +640,7 @@ static int ms_check_para() } } - if (ms_setting.nconns % ms_setting.nthreads != 0) + if (ms_setting.nconns % (uint32_t)ms_setting.nthreads != 0) { fprintf(stderr, "Concurrency must be the multiples of threads count.\n"); return -1; @@ -784,7 +784,7 @@ static void ms_monitor_slap_mode() { /* Wait all the connects complete warm up. */ pthread_mutex_lock(&ms_global.init_lock.lock); - while (ms_global.init_lock.count < ms_setting.nconns) + while (ms_global.init_lock.count < (int)ms_setting.nconns) { pthread_cond_wait(&ms_global.init_lock.cond, &ms_global.init_lock.lock); @@ -834,7 +834,7 @@ static void ms_monitor_slap_mode() * We loop until we know that all connects have cleaned up. */ pthread_mutex_lock(&ms_global.run_lock.lock); - while (ms_global.run_lock.count < ms_setting.nconns) + while (ms_global.run_lock.count < (int)ms_setting.nconns) { pthread_cond_wait(&ms_global.run_lock.cond, &ms_global.run_lock.lock); } diff --git a/clients/ms_conn.c b/clients/ms_conn.c index ea52c169..b488401c 100644 --- a/clients/ms_conn.c +++ b/clients/ms_conn.c @@ -919,12 +919,12 @@ static int ms_reconn(ms_conn_t *c) if (ms_setting.rep_write_srv > 0) { srv_idx= c->cur_idx; - srv_conn_cnt= ms_setting.nconns; + srv_conn_cnt= (int)ms_setting.nconns; } else { srv_idx= ms_thread->thread_ctx->srv_idx; - srv_conn_cnt= ms_setting.nconns / ms_setting.srv_cnt; + srv_conn_cnt= (int32_t)((int)ms_setting.nconns / ms_setting.srv_cnt); } /* close the old socket handler */ @@ -1047,12 +1047,12 @@ int ms_reconn_socks(ms_conn_t *c) if (ms_setting.rep_write_srv > 0) { srv_idx= i; - srv_conn_cnt= ms_setting.nconns; + srv_conn_cnt= (int)ms_setting.nconns; } else { srv_idx= ms_thread->thread_ctx->srv_idx; - srv_conn_cnt= ms_setting.nconns / ms_setting.srv_cnt; + srv_conn_cnt= (int)ms_setting.nconns / ms_setting.srv_cnt; } if (ms_network_connect(c, ms_setting.servers[srv_idx].srv_host_name, diff --git a/clients/ms_memslap.h b/clients/ms_memslap.h index 8777c5bb..87caca5d 100644 --- a/clients/ms_memslap.h +++ b/clients/ms_memslap.h @@ -71,7 +71,7 @@ typedef struct statistic /* global status statistic structure */ typedef struct stats { - volatile int32_t active_conns; /* active connections */ + volatile uint32_t active_conns; /* active connections */ size_t bytes_read; /* read bytes */ size_t bytes_written; /* written bytes */ size_t obj_bytes; /* object bytes */ diff --git a/clients/ms_setting.h b/clients/ms_setting.h index 7d31532c..f558dd32 100644 --- a/clients/ms_setting.h +++ b/clients/ms_setting.h @@ -112,7 +112,7 @@ typedef struct setting { int ncpu; /* cpu count of this system */ int nthreads; /* total thread count, must equal or less than cpu cores */ - int nconns; /* total conn count, must multiply by total thread count */ + uint32_t nconns; /* total conn count, must multiply by total thread count */ int64_t exec_num; /* total execute number */ int run_time; /* total run time */ diff --git a/clients/ms_thread.c b/clients/ms_thread.c index 048593d6..dbfc62a7 100644 --- a/clients/ms_thread.c +++ b/clients/ms_thread.c @@ -307,7 +307,7 @@ void ms_thread_init() for (int i= 0; i < ms_setting.nthreads; i++) { ms_thread_ctx[i].thd_idx= i; - ms_thread_ctx[i].nconns= ms_setting.nconns / ms_setting.nthreads; + ms_thread_ctx[i].nconns= (int)((int)ms_setting.nconns / ms_setting.nthreads); /** * If only one server, all the connections in all threads @@ -316,7 +316,7 @@ void ms_thread_init() */ ms_thread_ctx[i].srv_idx= i % ms_setting.srv_cnt; ms_thread_ctx[i].tps_perconn= ms_setting.expected_tps - / ms_setting.nconns; + / (int)ms_setting.nconns; ms_thread_ctx[i].exec_num_perconn= ms_setting.exec_num / ms_setting.nconns; }