commit - 0ac2a105ae58e86a8d224020f0a3c43358312e66
commit + 7b0b2065faf449f820b092afb74cf0af2dae79a3
blob - e402655115f19fb92b93a97aef7e0e47a45ce6ec
blob + 74491ac294fe02a14503503ccf6df95bcdcfe2ed
--- src/cmd/auxstats/Linux.c
+++ src/cmd/auxstats/Linux.c
vlong totb, totp, tote, totin, totou, totinb, totoub, b, p, e, in, ou, inb, oub;
char *q;
static int fd = -1;
+ static Reprog *netdev = nil;
if(first){
fd = open("/proc/net/dev", OREAD);
+ netdev = regcomp("^(eth[0-9]+|wlan[0-9]+|enp[0-9]+s[0-9]+f[0-9]+|wlp[0-9]+s[0-9]+)$");
return;
}
tokens(i);
if(ntok < 8+8)
continue;
- if(strncmp(tok[0], "eth", 3) != 0 && strncmp(tok[0], "wlan", 4) != 0)
+ if(regexec(netdev, tok[0], nil, 0) != 1)
continue;
inb = atoll(tok[1]);
oub = atoll(tok[9]);