Changeset View
Changeset View
Standalone View
Standalone View
head/tools/tools/ath/athaggrstats/athaggrstats.c
Show All 23 Lines | |||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||||
* THE POSSIBILITY OF SUCH DAMAGES. | * THE POSSIBILITY OF SUCH DAMAGES. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#include <sys/param.h> | |||||
#include "opt_ah.h" | #include "opt_ah.h" | ||||
/* | /* | ||||
* ath statistics class. | * ath statistics class. | ||||
*/ | */ | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/file.h> | #include <sys/file.h> | ||||
#include <sys/sockio.h> | #include <sys/sockio.h> | ||||
▲ Show 20 Lines • Show All 323 Lines • ▼ Show 20 Lines | ath_print_verbose(struct bsdstat *sf, FILE *fd) | ||||
fprintf(fd, "\n"); | fprintf(fd, "\n"); | ||||
} | } | ||||
BSDSTAT_DEFINE_BOUNCE(athaggrstatfoo) | BSDSTAT_DEFINE_BOUNCE(athaggrstatfoo) | ||||
struct athaggrstatfoo * | struct athaggrstatfoo * | ||||
athaggrstats_new(const char *ifname, const char *fmtstring) | athaggrstats_new(const char *ifname, const char *fmtstring) | ||||
{ | { | ||||
#define N(a) (sizeof(a) / sizeof(a[0])) | |||||
struct athaggrstatfoo_p *wf; | struct athaggrstatfoo_p *wf; | ||||
wf = calloc(1, sizeof(struct athaggrstatfoo_p)); | wf = calloc(1, sizeof(struct athaggrstatfoo_p)); | ||||
if (wf != NULL) { | if (wf != NULL) { | ||||
bsdstat_init(&wf->base.base, "athaggrstats", | bsdstat_init(&wf->base.base, "athaggrstats", | ||||
athaggrstats, N(athaggrstats)); | athaggrstats, nitems(athaggrstats)); | ||||
/* override base methods */ | /* override base methods */ | ||||
wf->base.base.collect_cur = ath_collect_cur; | wf->base.base.collect_cur = ath_collect_cur; | ||||
wf->base.base.collect_tot = ath_collect_tot; | wf->base.base.collect_tot = ath_collect_tot; | ||||
wf->base.base.get_curstat = ath_get_curstat; | wf->base.base.get_curstat = ath_get_curstat; | ||||
wf->base.base.get_totstat = ath_get_totstat; | wf->base.base.get_totstat = ath_get_totstat; | ||||
wf->base.base.update_tot = ath_update_tot; | wf->base.base.update_tot = ath_update_tot; | ||||
wf->base.base.print_verbose = ath_print_verbose; | wf->base.base.print_verbose = ath_print_verbose; | ||||
Show All 9 Lines | #endif | ||||
wf->s = socket(AF_INET, SOCK_DGRAM, 0); | wf->s = socket(AF_INET, SOCK_DGRAM, 0); | ||||
if (wf->s < 0) | if (wf->s < 0) | ||||
err(1, "socket"); | err(1, "socket"); | ||||
ath_setifname(&wf->base, ifname); | ath_setifname(&wf->base, ifname); | ||||
wf->base.setfmt(&wf->base, fmtstring); | wf->base.setfmt(&wf->base, fmtstring); | ||||
} | } | ||||
return &wf->base; | return &wf->base; | ||||
#undef N | |||||
} | } |