for (size_t i = 0; i < STATIC_ARRAY_SIZE(bounds); i++)
bounds[i]++;
- return (0);
+ return 0;
}
static int madwifi_config(const char *key, const char *value) {
int id = watchitem_find(value);
if (id < 0)
- return (-1);
+ return -1;
else
watchlist_add(watch_items, id);
}
int id = watchitem_find(value);
if (id < 0)
- return (-1);
+ return -1;
else
watchlist_remove(watch_items, id);
}
int id = watchitem_find(value);
if (id < 0)
- return (-1);
+ return -1;
else
watchlist_add(misc_items, id);
}
int id = watchitem_find(value);
if (id < 0)
- return (-1);
+ return -1;
else
watchlist_remove(misc_items, id);
}
else
- return (-1);
+ return -1;
- return (0);
+ return 0;
}
static void submit(const char *dev, const char *type, const char *ti1,
"SIOCGATHSTATS to device %s "
"failed with status %i.",
dev, status);
- return (status);
+ return status;
}
/* These stats are handled as a special case, because they are
/* All other ath statistics */
process_stat_struct(ATH_STAT, &stats, dev, NULL, "ath_stat", "ast_misc");
- return (0);
+ return 0;
}
static int process_80211stats(int sk, const char *dev) {
"SIOCG80211STATS to device %s "
"failed with status %i.",
dev, status);
- return (status);
+ return status;
}
process_stat_struct(IFA_STAT, &stats, dev, NULL, "ath_stat", "is_misc");
- return (0);
+ return 0;
}
static int process_station(int sk, const char *dev,
"IEEE80211_IOCTL_STA_STATS to device %s "
"failed with status %i.",
dev, status);
- return (status);
+ return status;
}
/* These two stats are handled as a special case as they are
/* All other node statistics */
process_stat_struct(NOD_STAT, ns, dev, mac, "node_stat", "ns_misc");
- return (0);
+ return 0;
}
static int process_stations(int sk, const char *dev) {
"IEEE80211_IOCTL_STA_INFO to device %s "
"failed with status %i.",
dev, status);
- return (status);
+ return status;
}
len = iwr.u.data.length;
if (item_watched(STAT_ATH_NODES))
submit_gauge(dev, "ath_nodes", NULL, NULL, nodes);
- return (0);
+ return 0;
}
static int process_device(int sk, const char *dev) {
if (status == 0)
num_success++;
- return ((num_success == 0) ? -1 : 0);
+ return (num_success == 0) ? -1 : 0;
}
static int check_devname(const char *dev) {
nets = opendir("/sys/class/net/");
if (nets == NULL) {
WARNING("madwifi plugin: opening /sys/class/net failed");
- return (-1);
+ return -1;
}
num_success = 0;
closedir(nets);
if ((num_success == 0) && (num_fail != 0))
- return (-1);
- return (0);
+ return -1;
+ return 0;
}
static int procfs_iterate(int sk) {
if ((fh = fopen("/proc/net/dev", "r")) == NULL) {
WARNING("madwifi plugin: opening /proc/net/dev failed");
- return (-1);
+ return -1;
}
num_success = 0;
fclose(fh);
if ((num_success == 0) && (num_fail != 0))
- return (-1);
+ return -1;
return 0;
}
sk = socket(AF_INET, SOCK_DGRAM, 0);
if (sk < 0)
- return (-1);
+ return -1;
/* procfs iteration is not safe because it does not check whether given
interface is madwifi interface and there are private ioctls used, which