htop.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # This patch removes the hard dependency on backtrace by checking for
  2. # it at compile time and adds a cross-compile /proc check.
  3. # Patch given to me by Hisham <hisham.hm@gmail.com> (htop-general)
  4. #
  5. # This patch is taken from upstream svn (r213, r215)
  6. #
  7. # Signed-off-by: Andy Kennedy <Andy.Kennedy@adtran.com>
  8. diff -Naur a/CRT.c b/CRT.c
  9. --- a/CRT.c 2010-11-23 09:56:32.000000000 -0600
  10. +++ b/CRT.c 2011-03-21 17:08:21.000000000 -0500
  11. @@ -11,7 +11,9 @@
  12. #include <signal.h>
  13. #include <stdlib.h>
  14. #include <stdbool.h>
  15. +#ifdef HAVE_EXECINFO_H
  16. #include <execinfo.h>
  17. +#endif
  18. #include "String.h"
  19. @@ -125,12 +127,14 @@
  20. CRT_done();
  21. #if __linux
  22. fprintf(stderr, "\n\nhtop " VERSION " aborting. Please report bug at http://htop.sf.net\n");
  23. - #else
  24. - fprintf(stderr, "\n\nhtop " VERSION " aborting. Unsupported platform.\n");
  25. - #endif
  26. + #ifdef HAVE_EXECINFO_H
  27. size_t size = backtrace(backtraceArray, sizeof(backtraceArray));
  28. fprintf(stderr, "Backtrace: \n");
  29. backtrace_symbols_fd(backtraceArray, size, 2);
  30. + #endif
  31. + #else
  32. + fprintf(stderr, "\n\nhtop " VERSION " aborting. Unsupported platform.\n");
  33. + #endif
  34. abort();
  35. }
  36. diff -Naur a/CRT.h b/CRT.h
  37. --- a/CRT.h 2010-11-23 09:56:32.000000000 -0600
  38. +++ b/CRT.h 2011-03-21 17:06:16.000000000 -0500
  39. @@ -14,7 +14,9 @@
  40. #include <signal.h>
  41. #include <stdlib.h>
  42. #include <stdbool.h>
  43. +#ifdef HAVE_EXECINFO_H
  44. #include <execinfo.h>
  45. +#endif
  46. #include "String.h"
  47. diff -Naur a/configure.ac b/configure.ac
  48. --- a/configure.ac 2010-11-23 09:56:32.000000000 -0600
  49. +++ b/configure.ac 2011-03-21 17:06:16.000000000 -0500
  50. @@ -25,6 +25,7 @@
  51. AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h curses.h],[:],[
  52. missing_headers="$missing_headers $ac_header"
  53. ])
  54. +AC_CHECK_HEADERS([execinfo.h],[:],[:])
  55. # Checks for typedefs, structures, and compiler characteristics.
  56. AC_HEADER_STDBOOL
  57. @@ -99,10 +100,10 @@
  58. AC_MSG_ERROR([missing headers: $missing_headers])
  59. fi
  60. -
  61. -
  62. +if test "$cross_compiling" = "no"; then
  63. AC_CHECK_FILE($PROCDIR/stat,,AC_MSG_ERROR(Cannot find /proc/stat. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.))
  64. AC_CHECK_FILE($PROCDIR/meminfo,,AC_MSG_ERROR(Cannot find /proc/meminfo. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.))
  65. +fi
  66. AC_ARG_ENABLE(plpa, [AC_HELP_STRING([--enable-plpa], [enable PLPA support for CPU affinity])], ,enable_plpa="yes")
  67. PLPA_INCLUDED