<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi All,<br>
    I am trying to create a stats object on my method to display stats
    on console. But, I am getting seg. fault when I do like this.<br>
    <br>
    <b>int numport;</b><b><br>
    </b><b>int* shufport;</b><b><br>
    </b><b>int i = 0, j;</b><b><br>
    </b><b>shufport = (int*)calloc(65536, sizeof(int));</b><b><br>
    </b><b>int availPorts = 0;</b><b><br>
    </b><b>for(j=0; j<65536; j++) {</b><b><br>
    </b><b>               
      if(daemon->cfg->outgoing_avail_ports[j]) {</b><b><br>
    </b><b>                        shufport[availPorts++] =
      daemon->cfg-></b><b><br>
    </b><b>                                outgoing_avail_ports[j];</b><b><br>
    </b><b>                }</b><b><br>
    </b><b>}</b><b><br>
    </b><b>if(availPorts == 0)</b><b><br>
    </b><b>  fatal_exit("no ports are permitted for UDP, add "</b><b><br>
    </b><b>                        "with outgoing-port-permit");</b><b><br>
    </b><b>log_info("No.of ports = %d", availPorts);</b><b><br>
    </b><b>numport = availPorts;</b><b><br>
    </b><b>daemon->num =
      (daemon->cfg->num_threads?daemon->cfg->num_threads:1);</b><b><br>
    </b><b>log_info("Daemon number = %d", daemon->num);</b><b><br>
      <br>
    </b><b>struct worker *worker = worker_create(daemon, i,
      shufport+numport*i/daemon->num,numport*(i+1)/daemon->num -
      numport*i/daemon->num);</b><b><br>
      <br>
    </b><b>log_info("Worker created");</b><b><br>
      <br>
    </b><b>struct server_stats *stats = &worker->stats;</b><b><br>
      <br>
    </b><b>log_info("Server stats obj created");</b><b><br>
      <br>
    </b><b>log_info("Zone queries = %ld", (long)stats->num_queries);</b><b><br>
      <br>
    </b><b>log_info("server stats  %u queries, "</b><b><br>
    </b><b>                "%u answers from cache, %u recursions, %u
      prefetch",</b><b><br>
    </b><b>                (unsigned)stats->num_queries,</b><b><br>
    </b><b>                (unsigned)(stats->num_queries -</b><b><br>
    </b><b>                        stats->num_queries_missed_cache),</b><b><br>
    </b><b>                (unsigned)stats->num_queries_missed_cache,</b><b><br>
    </b><b>                (unsigned)stats->num_queries_prefetch);</b><br>
    <pre class="moz-signature" cols="72">-- 
Thanks,
Nagesh Thati</pre>
  </body>
</html>