]> git.lttng.org Git - lttng-ust.git/commitdiff
Fix: Correct `numa_available` return code checks
authorKienan Stewart <kstewart@efficios.com>
Fri, 22 Nov 2024 14:17:50 +0000 (09:17 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 25 Nov 2024 16:04:49 +0000 (11:04 -0500)
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 <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/common/counter/shm.c
src/common/ringbuffer/shm.c

index 6f7ae37abd2c410483125cf4fa4e8d78710529b1..ee2b822ef29ed50a8899319f21f037bc172ffdc7 100644 (file)
@@ -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
 
index 347f9af0ab1d7aa6ca8353b0641daece84afd461..002e08984cf2c3a08bb467ee543a325ddfc2395b 100644 (file)
@@ -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
 
This page took 0.030302 seconds and 4 git commands to generate.