patch-main_c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. $OpenBSD: patch-main_c,v 1.1 2002/08/10 01:14:04 naddy Exp $
  2. --- main.c.orig Sun Sep 30 17:12:37 2001
  3. +++ main.c Tue Oct 16 18:14:04 2001
  4. @@ -51,6 +51,7 @@ LIST *UserClass = 0;
  5. char Buf[2048]; /* global scratch buffer */
  6. +int gBlockWinMX;
  7. HASH *Channel_Db;
  8. int Client_Queue_Length;
  9. HASH *Channels = 0; /* global channel list */
  10. @@ -330,7 +331,7 @@ report_stats (int fd)
  11. int n;
  12. struct sockaddr_in sin;
  13. socklen_t sinsize = sizeof (sin);
  14. - float loadavg = 0;
  15. + double loadavg = 0;
  16. n = accept (fd, (struct sockaddr *) &sin, &sinsize);
  17. if (n == -1)
  18. @@ -340,7 +341,10 @@ report_stats (int fd)
  19. }
  20. log_message ("report_stats: connection from %s:%d", inet_ntoa (sin.sin_addr),
  21. htons (sin.sin_port));
  22. -#ifdef linux
  23. +#if HAVE_GETLOADAVG
  24. + if (getloadavg (&loadavg, 1) < 0)
  25. + log_message ("report_stats: getloadavg: %s (errno %d)", strerror (errno), errno);
  26. +#elif defined(linux)
  27. {
  28. FILE *f = fopen ("/proc/loadavg", "r");
  29. @@ -356,8 +360,8 @@ report_stats (int fd)
  30. }
  31. }
  32. #endif /* linux */
  33. - snprintf (Buf, sizeof (Buf), "%d %d %.2f %.0f 0\n", Users->dbsize,
  34. - Num_Files, loadavg, Num_Gigs * 1024.);
  35. + snprintf (Buf, sizeof (Buf), "%d %d %0.2f %.0f %d\n", Users->dbsize,
  36. + Num_Files, loadavg, Num_Gigs * 1024., global.clients_num - list_count(Servers));
  37. WRITE (n, Buf, strlen (Buf));
  38. CLOSE (n);
  39. }