Skip to contentSkip to conversation

numactl: checks for numa when showing hardware

PATCH New Elena Ufimtseva 1 participant 1 message Nov 23, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 numactl: checks for numa when showing hardware

Checks if NUMA is available before printing hardware, otherwise segfault occurs.

---
 numactl.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
numactl.c +5 -0
index 97955a4..f30b53c 100755
@@ -242,6 +242,11 @@ void hardware(void)
 	int prevnode=-1;
 	int skip=0;
 	int maxnode = numa_max_node();
+	
+	if (numa_available() < 0) {
+                printf("No NUMA available on this system\n");
+                exit(1);
+        }
 
 	for (i=0; i<=maxnode; i++)
 		if (numa_bitmask_isbitset(numa_nodes_ptr, i))
Signature · 1 line
1.7.2.5