Commit a2613ee714 for qemu.org

commit a2613ee714aa3eb38e0524afa328ebfbf340a91f
Author: Roman Bogorodskiy <bogorodskiy@gmail.com>
Date:   Thu Oct 15 19:32:49 2026 +0200

    qga: fix build on illumos

    Currently, build fails on illumos with:

    ../qga/commands-posix.c: In function 'qmp_guest_get_load':
    ../qga/commands-posix.c:1408:9: error: implicit declaration of function 'getloadavg' [-Wimplicit-function-declaration]
     1408 |     if (getloadavg(loadavg, G_N_ELEMENTS(loadavg)) < 0) {
          |         ^~~~~~~~~~
    ../qga/commands-posix.c:1408:9: warning: nested extern declaration of 'getloadavg' [-Wnested-externs]

    This happens because including <sys/loadavg.h> which is needed
    for getloadavg() on illumos is nested under the "#ifdef HAVE_GETIFADDRS"
    block, and is not included when HAVE_GETIFADDRS is not defined.

    As getloadavg() does not depend on HAVE_GETIFADDRS, include
    <sys/loadavg.h> outside of the "#ifdef HAVE_GETIFADDRS".

    Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
    Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
    Message-ID: <20261015173250.65942-2-bogorodskiy@gmail.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index cfa5627a61..ae53eb3569 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -16,6 +16,9 @@
 #include <sys/utsname.h>
 #include <sys/wait.h>
 #include <dirent.h>
+#if defined(CONFIG_SOLARIS) && defined(CONFIG_GETLOADAVG)
+#include <sys/loadavg.h>
+#endif
 #include "qga-qapi-commands.h"
 #include "qapi/error.h"
 #include "qemu/host-utils.h"
@@ -43,9 +46,6 @@
 #include <net/ethernet.h>
 #endif
 #ifdef CONFIG_SOLARIS
-#ifdef CONFIG_GETLOADAVG
-#include <sys/loadavg.h>
-#endif
 #include <sys/sockio.h>
 #endif
 #endif