summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-process/htop/files/htop-0.8.1-no-plpa.patch')
-rw-r--r--sys-process/htop/files/htop-0.8.1-no-plpa.patch111
1 files changed, 111 insertions, 0 deletions
diff --git a/sys-process/htop/files/htop-0.8.1-no-plpa.patch b/sys-process/htop/files/htop-0.8.1-no-plpa.patch
new file mode 100644
index 000000000000..ee89da35bd4b
--- /dev/null
+++ b/sys-process/htop/files/htop-0.8.1-no-plpa.patch
@@ -0,0 +1,111 @@
+Not-linux hosts does not support PLPA.
+Since htop works also without it, why not?
+
+Original patch from FreeBSD by Yi-Jheng Lin <yzlin@cs.nctu.edu.tw>
+Modified to be conditional by Timothy Redaelli <drizzt@gentoo.org>
+
+https://bugs.gentoo.org/220469
+
+--- configure.ac
++++ configure.ac
+@@ -97,8 +97,9 @@
+
+ PLPA_INCLUDED(plpa-1.1)
+ PLPA_INIT(plpa_happy=yes, plpa_happy=no)
+-if test "x$plpa_happy" = xno; then
+- AC_MSG_ERROR([Failed to initialize PLPA.])
++AM_CONDITIONAL([HAVE_PLPA], [test "$plpa_happy" = "yes"])
++if test "$plpa_happy" = "yes"; then
++ AC_DEFINE([HAVE_PLPA], [1], [Have plpa])
+ fi
+
+ AC_CONFIG_FILES([Makefile])
+--- htop.c
++++ htop.c
+@@ -112,9 +112,11 @@
+ mvaddstr(15, 0, " F9 k: kill process/tagged processes P: sort by CPU%");
+ mvaddstr(16, 0, " + [ F7: lower priority (+ nice) M: sort by MEM%");
+ mvaddstr(17, 0, " - ] F8: higher priority (root only) T: sort by TIME");
++#ifdef HAVE_PLPA
+ if (pl->processorCount > 1)
+ mvaddstr(18, 0, " a: set CPU affinity F4 I: invert sort order");
+ else
++#endif
+ mvaddstr(18, 0, " F4 I: invert sort order");
+ mvaddstr(19, 0, " F2 S: setup F6 >: select sort column");
+ mvaddstr(20, 0, " F1 h: show this help screen");
+@@ -131,8 +133,10 @@
+ mvaddstr(16, 0, " + [ F7"); mvaddstr(16,40, " M");
+ mvaddstr(17, 0, " - ] F8"); mvaddstr(17,40, " T");
+ mvaddstr(18,40, " F4 I");
++#if HAVE_PLPA
+ if (pl->processorCount > 1)
+ mvaddstr(18, 0, " a:");
++#endif
+ mvaddstr(19, 0, " F2 S"); mvaddstr(19,40, " F6 >");
+ mvaddstr(20, 0, " F1 h");
+ mvaddstr(21, 0, " F10 q"); mvaddstr(21,40, " s");
+@@ -630,6 +634,7 @@
+ refreshTimeout = 0;
+ break;
+ }
++#ifdef HAVE_PLPA
+ case 'a':
+ {
+ if (pl->processorCount == 1)
+@@ -665,6 +670,7 @@
+ refreshTimeout = 0;
+ break;
+ }
++#endif
+ case KEY_F(10):
+ case 'q':
+ quit = 1;
+--- Process.c
++++ Process.c
+@@ -28,7 +28,9 @@
+ #include <pwd.h>
+ #include <sched.h>
+
++#ifdef HAVE_PLPA
+ #include <plpa.h>
++#endif
+
+ // This works only with glibc 2.1+. On earlier versions
+ // the behavior is similar to have a hardcoded page size.
+@@ -493,6 +495,7 @@
+ return (err == 0);
+ }
+
++#ifdef HAVE_PLPA
+ unsigned long Process_getAffinity(Process* this) {
+ unsigned long mask = 0;
+ plpa_sched_getaffinity(this->pid, sizeof(unsigned long), (plpa_cpu_set_t*) &mask);
+@@ -502,6 +505,7 @@
+ bool Process_setAffinity(Process* this, unsigned long mask) {
+ return (plpa_sched_setaffinity(this->pid, sizeof(unsigned long), (plpa_cpu_set_t*) &mask) == 0);
+ }
++#endif
+
+ void Process_sendSignal(Process* this, int signal) {
+ kill(this->pid, signal);
+--- Makefile.am
++++ Makefile.am
+@@ -1,5 +1,7 @@
+
++if HAVE_PLPA
+ SUBDIRS = plpa-1.1
++endif
+
+ bin_PROGRAMS = htop
+ dist_man_MANS = htop.1
+@@ -35,7 +37,9 @@
+
+ BUILT_SOURCES = $(myhtopheaders)
+ htop_SOURCES = $(myhtopheaders) $(myhtopsources) config.h debug.h
++if HAVE_PLPA
+ htop_LDADD = $(top_builddir)/plpa-1.1/src/libplpa_included.la
++endif
+
+ profile:
+ $(MAKE) all CFLAGS="-pg -O2"