osdep: Make qemu_madvise() return ENOSYS on unsupported OSes
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 5 Jun 2024 10:44:56 +0000 (12:44 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 8 Jun 2024 08:33:38 +0000 (10:33 +0200)
Not every OS is capable of madvise() or posix_madvise() even. In
that case, errno should be set to ENOSYS as it reflects the cause
better.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-ID: <b381c23bd8f413f1453a2c1a66e0979beaf27433.1717584048.git.mprivozn@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
util/osdep.c

index e42f4e8121dc6c6727f5de57be8e8e82404a1aee..5d23bbfbec4a901bc6b7f40aad1a1a75aefd33eb 100644 (file)
@@ -64,7 +64,7 @@ int qemu_madvise(void *addr, size_t len, int advice)
     }
     return 0;
 #else
-    errno = EINVAL;
+    errno = ENOSYS;
     return -1;
 #endif
 }