summaryrefslogtreecommitdiffstats
path: root/Action.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-06-13 11:29:39 +0200
committerBenny Baumann <BenBE@geshi.org>2021-07-18 07:50:48 +0200
commit1fb0c720fed4e93f6cfd6cf709a7d7028c3f2836 (patch)
treed16de102189cd996226ced71bf839825cb668462 /Action.c
parentadcedf87f5ac09e640179d8df3a4da1d9cb9f9a9 (diff)
Enable affinity support for non-Linux
sched_getaffinity() and sched_setaffinity() are also available on BSDs. Remove the Linux restraint.
Diffstat (limited to 'Action.c')
-rw-r--r--Action.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Action.c b/Action.c
index 86468635..62cb4525 100644
--- a/Action.c
+++ b/Action.c
@@ -34,7 +34,7 @@ in the source distribution for its full text.
#include "Vector.h"
#include "XUtils.h"
-#if (defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY))
+#if (defined(HAVE_LIBHWLOC) || defined(HAVE_AFFINITY))
#include "Affinity.h"
#include "AffinityPanel.h"
#endif
@@ -305,7 +305,7 @@ static Htop_Reaction actionSetAffinity(State* st) {
if (st->pl->activeCPUs == 1)
return HTOP_OK;
-#if (defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY))
+#if (defined(HAVE_LIBHWLOC) || defined(HAVE_AFFINITY))
const Process* p = (const Process*) Panel_getSelected((Panel*)st->mainPanel);
if (!p)
return HTOP_OK;
@@ -328,8 +328,11 @@ static Htop_Reaction actionSetAffinity(State* st) {
Affinity_delete(affinity2);
}
Object_delete(affinityPanel);
-#endif
return HTOP_REFRESH | HTOP_REDRAW_BAR | HTOP_UPDATE_PANELHDR;
+#else
+ return HTOP_OK;
+#endif
+
}
static Htop_Reaction actionKill(State* st) {
@@ -484,7 +487,7 @@ static const struct {
{ .key = " F9 k: ", .roInactive = true, .info = "kill process/tagged processes" },
{ .key = " F7 ]: ", .roInactive = true, .info = "higher priority (root only)" },
{ .key = " F8 [: ", .roInactive = false, .info = "lower priority (+ nice)" },
-#if (defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY))
+#if (defined(HAVE_LIBHWLOC) || defined(HAVE_AFFINITY))
{ .key = " a: ", .roInactive = true, .info = "set CPU affinity" },
#endif
{ .key = " e: ", .roInactive = false, .info = "show process environment" },

© 2014-2024 Faster IT GmbH | imprint | privacy policy