[Unbound-users] Unbound 1.4.21 - How do I get stats object on own method to display all available stats.

Nagesh Thati nagesh.thati at tcpwave.com
Wed Jan 8 10:03:20 UTC 2014


Hi All,
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.

*int numport;**
**int* shufport;**
**int i = 0, j;**
**shufport = (int*)calloc(65536, sizeof(int));**
**int availPorts = 0;**
**for(j=0; j<65536; j++) {**
**if(daemon->cfg->outgoing_avail_ports[j]) {**
**                        shufport[availPorts++] = daemon->cfg->**
**                                outgoing_avail_ports[j];**
**                }**
**}**
**if(availPorts == 0)**
**  fatal_exit("no ports are permitted for UDP, add "**
**                        "with outgoing-port-permit");**
**log_info("No.of ports = %d", availPorts);**
**numport = availPorts;**
**daemon->num = (daemon->cfg->num_threads?daemon->cfg->num_threads:1);**
**log_info("Daemon number = %d", daemon->num);**

**struct worker *worker = worker_create(daemon, i, 
shufport+numport*i/daemon->num,numport*(i+1)/daemon->num - 
numport*i/daemon->num);**

**log_info("Worker created");**

**struct server_stats *stats = &worker->stats;**

**log_info("Server stats obj created");**

**log_info("Zone queries = %ld", (long)stats->num_queries);**

**log_info("server stats  %u queries, "**
**                "%u answers from cache, %u recursions, %u prefetch",**
**                (unsigned)stats->num_queries,**
**                (unsigned)(stats->num_queries -**
**                        stats->num_queries_missed_cache),**
**                (unsigned)stats->num_queries_missed_cache,**
**                (unsigned)stats->num_queries_prefetch);*

-- 
Thanks,
Nagesh Thati

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nlnetlabs.nl/pipermail/unbound-users/attachments/20140108/7a9c0986/attachment.htm>


More information about the Unbound-users mailing list