]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : fix signed comparison warning on FreeBSD (#17497)
authorAdrien Gallouët <redacted>
Tue, 2 Dec 2025 11:05:38 +0000 (12:05 +0100)
committerGitHub <redacted>
Tue, 2 Dec 2025 11:05:38 +0000 (12:05 +0100)
This ensures correct RLIM_INFINITY handling and compatibility on all platforms (32/64-bit).

    warning: comparison of integers of different signs: 'rlim_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
      488 |         if (suggest && (lock_limit.rlim_max > lock_limit.rlim_cur + size)) {
          |                         ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Adrien Gallouët <redacted>
src/llama-mmap.cpp

index 47497cf953fd3990d6e147e4837980bed6223b63..0641c2d22f67651c93045d38ad2d59207008fe42 100644 (file)
@@ -485,7 +485,7 @@ struct llama_mlock::impl {
         if (suggest && getrlimit(RLIMIT_MEMLOCK, &lock_limit)) {
             suggest = false;
         }
-        if (suggest && (lock_limit.rlim_max > lock_limit.rlim_cur + size)) {
+        if (suggest && ((uint64_t)lock_limit.rlim_max > (uint64_t)lock_limit.rlim_cur + size)) {
             suggest = false;
         }
 #endif