version 1.16, 2009/08/13 23:45:35 |
version 1.17, 2009/11/23 01:51:41 |
|
|
struct ifcount ifs_cur; |
struct ifcount ifs_cur; |
struct ifcount ifs_old; |
struct ifcount ifs_old; |
struct ifcount ifs_now; |
struct ifcount ifs_now; |
|
char ifs_flag; |
} *ifstats; |
} *ifstats; |
|
|
static int nifs = 0; |
static int nifs = 0; |
|
|
struct sockaddr_dl *sdl; |
struct sockaddr_dl *sdl; |
char *buf, *next, *lim; |
char *buf, *next, *lim; |
static int s = -1; |
static int s = -1; |
int mib[6]; |
int mib[6], i; |
size_t need; |
size_t need; |
|
|
mib[0] = CTL_NET; |
mib[0] = CTL_NET; |
|
|
UPDATE(ifc_co, ifm_data.ifi_collisions); |
UPDATE(ifc_co, ifm_data.ifi_collisions); |
ifs->ifs_cur.ifc_flags = ifm.ifm_flags; |
ifs->ifs_cur.ifc_flags = ifm.ifm_flags; |
ifs->ifs_cur.ifc_state = ifm.ifm_data.ifi_link_state; |
ifs->ifs_cur.ifc_state = ifm.ifm_data.ifi_link_state; |
|
ifs->ifs_flag++; |
} |
} |
|
|
|
/* remove unreferenced interfaces */ |
|
for (i = 0; i < nifs; i++) { |
|
ifs = &ifstats[i]; |
|
if (ifs->ifs_flag) |
|
ifs->ifs_flag = 0; |
|
else |
|
ifs->ifs_name[0] = '\0'; |
|
} |
|
|
free(buf); |
free(buf); |
} |
} |
|
|