[PATCH i-g-t v11 5/7] tools: Include local glib header for Android

Badrappan, Jeevaka jeevaka.badrappan at intel.com
Mon Jun 2 19:10:47 UTC 2025


Hi Kamil,

> As glib is not available in Android, added local glib stub header to
> build igt for Android.
>
> Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan at intel.com>
> Acked-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> ---
>  tools/igt_dp_compliance.h | 4 ++++
>  tools/intel_pm_rpm.c      | 4 ++++
>  tools/lsgpu.c             | 4 ++++
>  3 files changed, 12 insertions(+)

> Same here, add some NULL handling to avoid NULL deref errors.

In lsgpu.c, g_key_file_get_string is used and NULL deref case is handled properly.

Regards,
Jeevaka

>
> diff --git a/tools/igt_dp_compliance.h b/tools/igt_dp_compliance.h
> index 5b1688039..226a13662 100644
> --- a/tools/igt_dp_compliance.h
> +++ b/tools/igt_dp_compliance.h
> @@ -28,7 +28,11 @@
>  #include <stdio.h>
>  #include <string.h>
>  #include <stdlib.h>
> +#ifdef ANDROID
> +#include "android/glib.h"
> +#else
>  #include <glib.h>
> +#endif
>
>  extern int drm_fd;
>
> diff --git a/tools/intel_pm_rpm.c b/tools/intel_pm_rpm.c
> index 9622f0552..c1cc54b82 100644
> --- a/tools/intel_pm_rpm.c
> +++ b/tools/intel_pm_rpm.c
> @@ -24,7 +24,11 @@
>
>  #include <errno.h>
>  #include <getopt.h>
> +#ifdef ANDROID
> +#include "android/glib.h"
> +#else
>  #include <glib.h>
> +#endif
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> diff --git a/tools/lsgpu.c b/tools/lsgpu.c
> index e68390083..6cfbf3142 100644
> --- a/tools/lsgpu.c
> +++ b/tools/lsgpu.c
> @@ -24,7 +24,11 @@
>
>  #include <errno.h>
>  #include <fcntl.h>
> +#ifdef ANDROID
> +#include "android/glib.h"
> +#else
>  #include <glib.h>
> +#endif
>  #include <libudev.h>
>  #include <string.h>
>  #include <signal.h>
> --
> 2.49.0
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20250602/4e345120/attachment.htm>


More information about the igt-dev mailing list