version 1.5, 2008/09/01 23:30:08 |
version 1.6, 2008/10/08 15:11:13 |
|
|
#include <unistd.h> |
#include <unistd.h> |
#include <stdarg.h> |
#include <stdarg.h> |
|
|
|
#include "systat.h" |
#include "engine.h" |
#include "engine.h" |
#include "cache.h" |
#include "cache.h" |
|
|
|
|
prev->next = node; |
prev->next = node; |
} |
} |
} |
} |
if (*root != node) { |
} |
struct pf_altq_node *prev_flat = *root; |
|
while (prev_flat->next_flat != NULL) { |
void |
prev_flat = prev_flat->next_flat; |
pfctl_set_next_flat(struct pf_altq_node *node, struct pf_altq_node *up) |
} |
{ |
prev_flat->next_flat = node; |
while (node) { |
|
struct pf_altq_node *next = node->next ? node->next : up; |
|
if (node->children) { |
|
node->next_flat = node->children; |
|
pfctl_set_next_flat(node->children, next); |
|
} else |
|
node->next_flat = next; |
|
node = node->next; |
} |
} |
} |
} |
|
|
|
|
u_int32_t nr; |
u_int32_t nr; |
struct queue_stats qstats; |
struct queue_stats qstats; |
u_int32_t nr_queues; |
u_int32_t nr_queues; |
|
int ret = 0; |
|
|
*inserts = 0; |
*inserts = 0; |
memset(&pa, 0, sizeof(pa)); |
memset(&pa, 0, sizeof(pa)); |
|
|
error("DIOCGETALTQS: %s", strerror(errno)); |
error("DIOCGETALTQS: %s", strerror(errno)); |
return (-1); |
return (-1); |
} |
} |
|
|
num_queues = nr_queues = pa.nr; |
num_queues = nr_queues = pa.nr; |
for (nr = 0; nr < nr_queues; ++nr) { |
for (nr = 0; nr < nr_queues; ++nr) { |
pa.nr = nr; |
pa.nr = nr; |
if (ioctl(pf_dev, DIOCGETALTQ, &pa)) { |
if (ioctl(pf_dev, DIOCGETALTQ, &pa)) { |
error("DIOCGETALTQ: %s", strerror(errno)); |
error("DIOCGETALTQ: %s", strerror(errno)); |
return (-1); |
ret = -1; |
|
break; |
} |
} |
if (pa.altq.qid > 0) { |
if (pa.altq.qid > 0) { |
pq.nr = nr; |
pq.nr = nr; |
|
|
pq.nbytes = sizeof(qstats); |
pq.nbytes = sizeof(qstats); |
if (ioctl(pf_dev, DIOCGETQSTATS, &pq)) { |
if (ioctl(pf_dev, DIOCGETQSTATS, &pq)) { |
error("DIOCGETQSTATS: %s", strerror(errno)); |
error("DIOCGETQSTATS: %s", strerror(errno)); |
return (-1); |
ret = -1; |
|
break; |
} |
} |
qstats.valid = 1; |
qstats.valid = 1; |
gettimeofday(&qstats.timestamp, NULL); |
gettimeofday(&qstats.timestamp, NULL); |
|
|
else |
else |
--num_queues; |
--num_queues; |
} |
} |
return (0); |
|
|
pfctl_set_next_flat(*root, NULL); |
|
|
|
return (ret); |
} |
} |
|
|
void |
void |