From 270321d89d7e218e90ba5ebcda2bceb3ffe3a2f7 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Fri, 22 Nov 2024 09:17:50 -0500 Subject: [PATCH] Fix: Correct `numa_available` return code checks As of 0.9.2, the documentation has been updated to state that `numa_available` returns `-1` on failure[1]. In previous versions the documentation stated "any negative value", although `-1` appears to be the only error return value as far back as v0.5[2]. `0` should be considered a successful response when checking the return code of this function. [1]: https://github.com/numactl/numactl/blob/4eee394215cde8420e5d3a75fcad02f27940bd6d/numa.3#L154 [2]: https://github.com/numactl/numactl/blob/0ab0fa63dac14d08ab967ec9916122aada0fc6b0/libnuma.c#L190 Change-Id: Ic44274971f39ea76082246692c1d6d7bc1515c2f Signed-off-by: Kienan Stewart Signed-off-by: Mathieu Desnoyers --- src/common/counter/shm.c | 2 +- src/common/ringbuffer/shm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/counter/shm.c b/src/common/counter/shm.c index 6f7ae37a..ee2b822e 100644 --- a/src/common/counter/shm.c +++ b/src/common/counter/shm.c @@ -191,7 +191,7 @@ static bool lttng_is_numa_available(void) if (ret && errno == ENOSYS) { return false; } - return numa_available() > 0; + return numa_available() >= 0; } #endif diff --git a/src/common/ringbuffer/shm.c b/src/common/ringbuffer/shm.c index 347f9af0..002e0898 100644 --- a/src/common/ringbuffer/shm.c +++ b/src/common/ringbuffer/shm.c @@ -250,7 +250,7 @@ static bool lttng_is_numa_available(void) if (ret && errno == ENOSYS) { return false; } - return numa_available() > 0; + return numa_available() >= 0; } #endif -- 2.39.5