MCPcopy Create free account
hub / github.com/F-Stack/f-stack / perform_command

Function perform_command

dpdk/lib/telemetry/telemetry.c:350–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350static void
351perform_command(telemetry_cb fn, const char *cmd, const char *param, int s)
352{
353 struct rte_tel_data data = {0};
354
355 int ret = fn(cmd, param, &data);
356 if (ret < 0) {
357 char out_buf[MAX_CMD_LEN + 10];
358 int used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":null}",
359 MAX_CMD_LEN, cmd ? cmd : "none");
360 if (write(s, out_buf, used) < 0)
361 perror("Error writing to socket");
362 return;
363 }
364 output_json(cmd, &data, s);
365}
366
367static int
368unknown_command(const char *cmd __rte_unused, const char *params __rte_unused,

Callers 1

client_handlerFunction · 0.70

Calls 3

snprintfFunction · 0.85
output_jsonFunction · 0.85
writeFunction · 0.50

Tested by

no test coverage detected