Sign fix for variable (this should solve the solaris warning).
authorBrian Aker <brian@gaz>
Thu, 14 Jan 2010 06:35:31 +0000 (22:35 -0800)
committerBrian Aker <brian@gaz>
Thu, 14 Jan 2010 06:35:31 +0000 (22:35 -0800)
clients/memslap.c
clients/ms_conn.c
clients/ms_memslap.h
clients/ms_setting.h
clients/ms_thread.c

index efda8affae122722bb2f5aae61db84ad7d31488d..88a0f21ca25be9b4dde03b8d9b43613d8d368ff5 100644 (file)
@@ -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);
     }
index ea52c169de8b31dbd3cbfb576188857523f523de..b488401c126d6298919ad22cbb72f71bdb3c5327 100644 (file)
@@ -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,
index 8777c5bb2466a14419a37b5e6be47699c926adb4..87caca5dc1408ba422c5fec17c7e09ee1520dddd 100644 (file)
@@ -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 */
index 7d31532c8b5ea7a8590de1402bcc82112724f711..f558dd32fe837214b7971d8c0a51803a0f80782c 100644 (file)
@@ -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 */
 
index 048593d6d0ad26ab3d640e567c069b64d5387625..dbfc62a7965194bc49c9c92f0527e15a239054f2 100644 (file)
@@ -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;
   }