[PATCH v15 3/9] lib/igt_aux: Handle absence of libproc2 in Android
Jeevaka Prabu Badrappan
jeevaka.badrappan at intel.com
Wed Jun 4 17:16:50 UTC 2025
Handle the absence of libproc2 in Android by conditionally including
libproc2 headers and function calls based on the definition of
HAVE_LIBPROC2. This ensures compatibility by only compiling
libproc2-related code when the library is available.
Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan at intel.com>
---
lib/igt_aux.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 2905824a5..5c2679812 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -55,7 +55,7 @@
#ifdef HAVE_LIBPROCPS
# include <proc/readproc.h>
-#else
+#elif HAVE_LIBPROC2
# include <libproc2/pids.h>
#endif
@@ -1289,7 +1289,7 @@ struct igt_process {
#ifdef HAVE_LIBPROCPS
PROCTAB * proc;
proc_t *proc_info;
-#else
+#elif HAVE_LIBPROC2
struct pids_info *info;
struct pids_stack *stack;
#endif
@@ -1305,7 +1305,7 @@ static void open_process(struct igt_process *prcs)
prcs->proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG);
igt_assert_f(prcs->proc != NULL, "procps open failed\n");
prcs->proc_info = NULL;
-#else
+#elif HAVE_LIBPROC2
enum pids_item Items[] = { PIDS_ID_PID, PIDS_ID_EUID, PIDS_ID_EGID, PIDS_CMD };
int err;
@@ -1327,7 +1327,7 @@ static void close_process(struct igt_process *prcs)
closeproc(prcs->proc);
prcs->proc_info = NULL;
prcs->proc = NULL;
-#else
+#elif HAVE_LIBPROC2
procps_pids_unref(&prcs->info);
prcs->info = NULL;
#endif
@@ -1351,7 +1351,7 @@ static bool get_process_ids(struct igt_process *prcs)
prcs->egid = prcs->proc_info->egid;
prcs->comm = prcs->proc_info->cmd;
}
-#else
+#elif HAVE_LIBPROC2
enum rel_items { EU_PID, EU_EUID, EU_EGID, EU_CMD }; // order at open
prcs->tid = 0;
--
2.49.0
More information about the igt-dev
mailing list