]> Sergey Matveev's repositories - dht-bootstrap.git/commitdiff
Stats in process title
authorSergey Matveev <stargrave@stargrave.org>
Thu, 10 Nov 2022 12:02:23 +0000 (15:02 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 10 Nov 2022 12:04:29 +0000 (15:04 +0300)
CHANGES
dht-bootstrap.c

diff --git a/CHANGES b/CHANGES
index d54f227682f81da8e8676ac2b88e5e433f4f59cb..69f55643c054824033835b3240c433a6e9668918 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,7 @@
   * select() replaced with poll()
   * arc4random instead of /dev/urandom reading
   * Some simple hardening
+  * Keep statistics in process title (BSD)
 
 20 November 2011: dht-bootstrap-0.2
 
index e8c0b2c7bd87dc7bc40359e4f8223af248cf006c..07ac332d8d5befe169585494109d81dfb7ff221d 100644 (file)
@@ -37,6 +37,12 @@ THE SOFTWARE.
 
 #define MIN(x, y) ((x) <= (y) ? (x) : (y))
 
+#ifdef __linux__
+// clang-format off
+void setproctitle_fast(const char *_fmt, ...) {}
+// clang-format on
+#endif
+
 static int
 send_ping(struct sockaddr *sa, int salen, const unsigned char *tid, int tid_len);
 static int
@@ -507,13 +513,12 @@ main(int argc, char **argv)
             tv_sec = random() % 30;
         int tv_msec = random() % 1000;
 
-        if (dht_debug)
-            debugf(
-                "%d+%d %d+%d\n",
-                list_elements(&v4_confirmed),
-                list_elements(&v6_confirmed),
-                list_elements(&v4_new),
-                list_elements(&v6_new));
+        setproctitle_fast(
+            "%d+%d %d+%d",
+            list_elements(&v4_confirmed),
+            list_elements(&v6_confirmed),
+            list_elements(&v4_new),
+            list_elements(&v6_new));
 
         rc = poll(fds, 2, tv_sec * 1000 + tv_msec);
         if (rc < 0) {