You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
853 B

  1. From 76abf78aac8c56606fb52ea874873d790b9044da Mon Sep 17 00:00:00 2001
  2. From: "Pawel Hajdan, Jr" <phajdan.jr@chromium.org>
  3. Date: Mon, 2 Jan 2017 10:42:35 +0000
  4. Subject: [PATCH] Fix build with uclibc
  5. Resolves #985
  6. This is based on musl implementation,
  7. http://git.musl-libc.org/cgit/musl/commit/?id=20cbd607759038dca57f84ef7e7b5d44a3088574
  8. (thanks to jbergstroem@ for reference)
  9. ---
  10. src/util.cc | 7 +++++++
  11. 1 file changed, 7 insertions(+)
  12. --- a/src/util.cc
  13. +++ b/src/util.cc
  14. @@ -572,6 +572,13 @@ double GetLoadAverage() {
  15. return -0.0f;
  16. return 1.0 / (1 << SI_LOAD_SHIFT) * si.loads[0];
  17. }
  18. +#elif defined(__UCLIBC__)
  19. +double GetLoadAverage() {
  20. + struct sysinfo si;
  21. + if (sysinfo(&si) != 0)
  22. + return -0.0f;
  23. + return 1.0 / (1 << SI_LOAD_SHIFT) * si.loads[0];
  24. +}
  25. #else
  26. double GetLoadAverage() {
  27. double loadavg[3] = { 0.0f, 0.0f, 0.0f };