-#define RRDD_STATS_SEND \
- outbuf[sizeof (outbuf) - 1] = 0; \
- status = swrite (fd, outbuf, strlen (outbuf)); \
- if (status < 0) \
- { \
- status = errno; \
- RRDD_LOG (LOG_INFO, "handle_request_stats: swrite returned an error."); \
- return (status); \
- }
-
- strncpy (outbuf, "9 Statistics follow\n", sizeof (outbuf));
- RRDD_STATS_SEND;
-
- snprintf (outbuf, sizeof (outbuf),
- "QueueLength: %"PRIu64"\n", copy_queue_length);
- RRDD_STATS_SEND;
-
- snprintf (outbuf, sizeof (outbuf),
- "UpdatesReceived: %"PRIu64"\n", copy_updates_received);
- RRDD_STATS_SEND;
-
- snprintf (outbuf, sizeof (outbuf),
- "FlushesReceived: %"PRIu64"\n", copy_flush_received);
- RRDD_STATS_SEND;
-
- snprintf (outbuf, sizeof (outbuf),
- "UpdatesWritten: %"PRIu64"\n", copy_updates_written);
- RRDD_STATS_SEND;
-
- snprintf (outbuf, sizeof (outbuf),
- "DataSetsWritten: %"PRIu64"\n", copy_data_sets_written);
- RRDD_STATS_SEND;
-
- snprintf (outbuf, sizeof (outbuf),
- "TreeNodesNumber: %"PRIu64"\n", tree_nodes_number);
- RRDD_STATS_SEND;
-
- snprintf (outbuf, sizeof (outbuf),
- "TreeDepth: %"PRIu64"\n", tree_depth);
- RRDD_STATS_SEND;
-
- snprintf (outbuf, sizeof(outbuf),
- "JournalBytes: %"PRIu64"\n", copy_journal_bytes);
- RRDD_STATS_SEND;
-
- snprintf (outbuf, sizeof(outbuf),
- "JournalRotate: %"PRIu64"\n", copy_journal_rotate);
- RRDD_STATS_SEND;
+ add_response_info(sock,
+ "QueueLength: %"PRIu64"\n", copy_queue_length);
+ add_response_info(sock,
+ "UpdatesReceived: %"PRIu64"\n", copy_updates_received);
+ add_response_info(sock,
+ "FlushesReceived: %"PRIu64"\n", copy_flush_received);
+ add_response_info(sock,
+ "UpdatesWritten: %"PRIu64"\n", copy_updates_written);
+ add_response_info(sock,
+ "DataSetsWritten: %"PRIu64"\n", copy_data_sets_written);
+ add_response_info(sock, "TreeNodesNumber: %"PRIu64"\n", tree_nodes_number);
+ add_response_info(sock, "TreeDepth: %"PRIu64"\n", tree_depth);
+ add_response_info(sock, "JournalBytes: %"PRIu64"\n", copy_journal_bytes);
+ add_response_info(sock, "JournalRotate: %"PRIu64"\n", copy_journal_rotate);
+
+ send_response(sock, RESP_OK, "Statistics follow\n");