<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I am running this code in an infinite loop "while(1)", I am getting
all 0 values, I am doing DIG in other tab still it is displaying 0
values.<br>
<div class="moz-cite-prefix">On 8/1/2014 3:33 PM, Nagesh Thati
wrote:<br>
</div>
<blockquote cite="mid:52CD2268.1060103@tcpwave.com" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Unbound-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Unbound-users@unbound.net">Unbound-users@unbound.net</a>
<a class="moz-txt-link-freetext" href="http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users">http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Thanks,
Nagesh Thati</pre>
</body>
</html>