MCPcopy Create free account
hub / github.com/apache/trafficserver / setBondingStat

Function setBondingStat

plugins/experimental/system_stats/system_stats.cc:190–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190static void
191setBondingStat(TSMutex stat_creation_mutex, const char *interface)
192{
193 char infdir[PATH_MAX];
194 struct dirent *dent;
195
196 memset(&infdir[0], 0, sizeof(infdir));
197
198 if (interface == nullptr) {
199 TSError("%s: nullptr interface", DEBUG_TAG);
200 return;
201 }
202
203 snprintf(&infdir[0], sizeof(infdir), "%s/%s", NET_STATS_DIR, interface);
204 DIR *localdir = opendir(infdir);
205
206 while ((dent = readdir(localdir)) != nullptr) {
207 if (((strncmp(SLAVE, dent->d_name, strlen(SLAVE)) == 0) || (strncmp(LOWER, dent->d_name, strlen(LOWER)) == 0)) &&
208 (dent->d_type == DT_LNK)) {
209 // We have a symlink starting with slave or lower, get its speed
210 setNetStat(stat_creation_mutex, interface, "speed", dent->d_name, true);
211 }
212
213 if (strncmp(BONDING_SLAVE_DIR, dent->d_name, strlen(BONDING_SLAVE_DIR)) == 0 && (dent->d_type != DT_LNK)) {
214 setNetStat(stat_creation_mutex, interface, "ad_actor_oper_port_state", dent->d_name, false);
215 setNetStat(stat_creation_mutex, interface, "ad_partner_oper_port_state", dent->d_name, false);
216 }
217 }
218
219 closedir(localdir);
220}
221
222static int
223netStatsInfo(TSMutex stat_creation_mutex)

Callers 1

netStatsInfoFunction · 0.85

Calls 3

memsetFunction · 0.85
setNetStatFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected