BSD-Sysctl
view release on metacpan or search on metacpan
(double)inf->tv_sec + ((double)inf->tv_usec/1000000)
);
break;
}
/* the remaining custom formats are for opaque mibs */
#if __FreeBSD_version < 1000000
case FMT_MBSTAT: {
HV *c = (HV *)sv_2mortal((SV *)newHV());
struct mbstat *inf = (struct mbstat *)buf;
RETVAL = newRV((SV *)c);
hv_store(c, "copymfail", 9, newSVuv(inf->m_mcfail), 0);
hv_store(c, "pullupfail", 10, newSVuv(inf->m_mpfail), 0);
hv_store(c, "mbufsize", 8, newSVuv(inf->m_msize), 0);
hv_store(c, "mclustsize", 10, newSVuv(inf->m_mclbytes), 0);
hv_store(c, "minclsize", 9, newSVuv(inf->m_minclsize), 0);
hv_store(c, "mbuflen", 7, newSVuv(inf->m_mlen), 0);
hv_store(c, "mbufhead", 8, newSVuv(inf->m_mhlen), 0);
hv_store(c, "drain", 5, newSVuv(inf->m_drain), 0);
#if __FreeBSD_version < 500000
hv_store(c, "numtypes", 8, newSVpvn("", 0), 0);
#else
hv_store(c, "numtypes", 8, newSViv(inf->m_numtypes), 0);
#endif
#if __FreeBSD_version < 600000
hv_store(c, "mbufs", 5, newSVpvn("", 0), 0);
hv_store(c, "mclusts", 7, newSVpvn("", 0), 0);
hv_store(c, "sfallocwait", 11, newSVpvn("", 0), 0);
hv_store(c, "sfiocnt", 7, newSVpvn("", 0), 0);
#else
hv_store(c, "mbufs", 5, newSVuv(inf->m_mbufs), 0);
hv_store(c, "mclusts", 7, newSVuv(inf->m_mclusts), 0);
hv_store(c, "sfallocwait", 11, newSVuv(inf->sf_allocwait), 0);
hv_store(c, "sfiocnt", 7, newSVuv(inf->sf_iocnt), 0);
#endif
break;
}
#endif
case FMT_NTPTIMEVAL: {
HV *c = (HV *)sv_2mortal((SV *)newHV());
struct ntptimeval *inf = (struct ntptimeval *)buf;
RETVAL = newRV((SV *)c);
hv_store(c, "sec", 3, newSVuv(inf->time.tv_sec), 0);
hv_store(c, "nanosec", 7, newSViv(inf->time.tv_nsec), 0);
hv_store(c, "maxerror", 8, newSViv(inf->maxerror), 0);
hv_store(c, "esterror", 8, newSViv(inf->esterror), 0);
hv_store(c, "taioffset", 9, newSViv(inf->tai), 0);
hv_store(c, "timestate", 9, newSViv(inf->time_state), 0);
break;
}
case FMT_DEVSTAT: {
HV *c = (HV *)sv_2mortal((SV *)newHV());
struct devstat *inf = (struct devstat *)buf;
RETVAL = newRV((SV *)c);
hv_store(c, "devno", 5, newSViv(inf->device_number), 0);
hv_store(c, "unitno", 6, newSViv(inf->unit_number), 0);
#if __FreeBSD_version < 500000
hv_store(c, "sequence", 8, newSVpvn("", 0), 0);
hv_store(c, "allocated", 9, newSVpvn("", 0), 0);
hv_store(c, "startcount", 10, newSVpvn("", 0), 0);
hv_store(c, "endcount", 8, newSVpvn("", 0), 0);
hv_store(c, "busyfromsec", 11, newSVpvn("", 0), 0);
hv_store(c, "busyfromfrac", 12, newSVpvn("", 0), 0);
#else
hv_store(c, "sequence", 8, newSVuv(inf->sequence0), 0);
hv_store(c, "allocated", 9, newSViv(inf->allocated), 0);
hv_store(c, "startcount", 10, newSViv(inf->start_count), 0);
hv_store(c, "endcount", 8, newSViv(inf->end_count), 0);
hv_store(c, "busyfromsec", 11, newSViv(inf->busy_from.sec), 0);
hv_store(c, "busyfromfrac", 12, newSVuv(inf->busy_from.frac), 0);
#endif
break;
}
#if __FreeBSD_version >= 500000
case FMT_XVFSCONF: {
HV *c = (HV *)sv_2mortal((SV *)newHV());
struct xvfsconf *inf = (struct xvfsconf *)buf;
RETVAL = newRV((SV *)c);
hv_store(c, "name", 4, newSVpv(inf->vfc_name, 0), 0);
hv_store(c, "typenum", 7, newSViv(inf->vfc_typenum), 0);
hv_store(c, "refcount", 8, newSViv(inf->vfc_refcount), 0);
hv_store(c, "flags", 5, newSViv(inf->vfc_flags), 0);
break;
}
#endif
case FMT_ICMPSTAT: {
HV *c = (HV *)sv_2mortal((SV *)newHV());
struct icmpstat *inf = (struct icmpstat *)buf;
RETVAL = newRV((SV *)c);
hv_store(c, "error", 5, newSViv(inf->icps_error), 0);
hv_store(c, "badcode", 7, newSViv(inf->icps_badcode), 0);
hv_store(c, "tooshort", 8, newSViv(inf->icps_tooshort), 0);
hv_store(c, "checksum", 8, newSViv(inf->icps_checksum), 0);
hv_store(c, "badlen", 6, newSViv(inf->icps_badlen), 0);
hv_store(c, "reflect", 7, newSViv(inf->icps_reflect), 0);
hv_store(c, "bmcastecho", 10, newSViv(inf->icps_bmcastecho), 0);
hv_store(c, "bmcasttstamp", 12, newSViv(inf->icps_bmcasttstamp), 0);
hv_store(c, "badaddr", 7, newSViv(inf->icps_badaddr), 0);
hv_store(c, "noroute", 7, newSViv(inf->icps_noroute), 0);
break;
}
case FMT_IGMPSTAT: {
HV *c = (HV *)sv_2mortal((SV *)newHV());
struct igmpstat *inf = (struct igmpstat *)buf;
RETVAL = newRV((SV *)c);
#if __FreeBSD_version < 800070
hv_store(c, "total", 5, newSVuv(inf->igps_rcv_total), 0);
hv_store(c, "tooshort", 8, newSVuv(inf->igps_rcv_tooshort), 0);
hv_store(c, "badsum", 6, newSVuv(inf->igps_rcv_badsum), 0);
hv_store(c, "queries", 7, newSVuv(inf->igps_rcv_queries), 0);
hv_store(c, "badqueries", 10, newSVuv(inf->igps_rcv_badqueries), 0);
hv_store(c, "reports", 7, newSVuv(inf->igps_rcv_reports), 0);
hv_store(c, "badreports", 10, newSVuv(inf->igps_rcv_badreports), 0);
hv_store(c, "ourreports", 10, newSVuv(inf->igps_rcv_ourreports), 0);
hv_store(c, "sent", 4, newSVuv(inf->igps_snd_reports), 0);
#else
/* Message statistics */
hv_store(c, "total", 5, newSVuv(inf->igps_rcv_total), 0);
hv_store(c, "tooshort", 8, newSVuv(inf->igps_rcv_tooshort), 0);
hv_store(c, "badttl", 6, newSVuv(inf->igps_rcv_badttl), 0);
hv_store(c, "badsum", 6, newSVuv(inf->igps_rcv_badsum), 0);
/* Query statistics */
hv_store(c, "queries", 7, newSVuv(inf->igps_rcv_v1v2_queries + inf->igps_rcv_v3_queries), 0);
hv_store(c, "v1v2_queries", 12, newSVuv(inf->igps_rcv_v1v2_queries), 0);
hv_store(c, "v3_queries", 10, newSVuv(inf->igps_rcv_v3_queries), 0);
hv_store(c, "badqueries", 10, newSVuv(inf->igps_rcv_badqueries), 0);
hv_store(c, "gen_queries", 11, newSVuv(inf->igps_rcv_gen_queries), 0);
hv_store(c, "group_queries", 13, newSVuv(inf->igps_rcv_group_queries), 0);
hv_store(c, "gsr_queries", 11, newSVuv(inf->igps_rcv_gsr_queries), 0);
hv_store(c, "drop_gsr_queries", 16, newSVuv(inf->igps_drop_gsr_queries), 0);
( run in 0.543 second using v1.01-cache-2.11-cpan-39bf76dae61 )