Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: igt-dev@lists.freedesktop.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: [PATCH i-g-t] lib/igt_aux.c: since procps-ng 4.0.5, PIDS_VAL() takes 3 arguments, not 4
Date: Fri,  3 Jan 2025 23:26:28 +0100	[thread overview]
Message-ID: <20250103222628.4069004-1-thomas.petazzoni@bootlin.com> (raw)

Unfortunately, the API of procps-ng has changed between procps-ng
4.0.4 and procps-ng 4.0.5, with the PIDS_VAL() macro changing in
upstream commit
https://gitlab.com/procps-ng/procps/-/commit/967fdcfb06e20aad0f31073474cb94545c9bdea5.

This API breakage has been reported upstream as of
https://gitlab.com/procps-ng/procps/-/issues/366, but in the mean
time, the build of igt-gpu-tools breaks with:

../lib/igt_aux.c:1358:78: error: macro "PIDS_VAL" passed 4 arguments, but takes just 3

We fix this by detecting the version of the libproc2 library, and
adjusting accordingly how PIDS_VAL() gets used.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 lib/igt_aux.c | 7 +++++++
 meson.build   | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 3407cc4f2..f5bf48da6 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1358,10 +1358,17 @@ static bool get_process_ids(struct igt_process *prcs)
 	prcs->comm = NULL;
 	prcs->stack = procps_pids_get(prcs->info, PIDS_FETCH_TASKS_ONLY);
 	if (prcs->stack) {
+#if defined(HAVE_LIBPROC2_POST_4_0_5_API)
+		prcs->tid = PIDS_VAL(EU_PID, s_int, prcs->stack);
+		prcs->euid = PIDS_VAL(EU_EUID, s_int, prcs->stack);
+		prcs->egid = PIDS_VAL(EU_EGID, s_int, prcs->stack);
+		prcs->comm = PIDS_VAL(EU_CMD, str, prcs->stack);
+#else
 		prcs->tid = PIDS_VAL(EU_PID, s_int, prcs->stack, prcs->info);
 		prcs->euid = PIDS_VAL(EU_EUID, s_int, prcs->stack, prcs->info);
 		prcs->egid = PIDS_VAL(EU_EGID, s_int, prcs->stack, prcs->info);
 		prcs->comm = PIDS_VAL(EU_CMD, str, prcs->stack, prcs->info);
+#endif
 	}
 #endif
 	return prcs->tid != 0;
diff --git a/meson.build b/meson.build
index 8b2a2a64a..f3e645c4d 100644
--- a/meson.build
+++ b/meson.build
@@ -139,6 +139,9 @@ if libprocps.found()
   config.set('HAVE_LIBPROCPS', 1)
 elif libproc2.found()
   config.set('HAVE_LIBPROC2', 1)
+  if libproc2.version().version_compare('>= 4.0.5')
+    config.set('HAVE_LIBPROC2_POST_4_0_5_API', 1)
+  endif
 else
   error('Either libprocps or libproc2 is required')
 endif
-- 
2.47.1


             reply	other threads:[~2025-01-03 22:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-03 22:26 Thomas Petazzoni [this message]
2025-01-03 23:33 ` [PATCH i-g-t] lib/igt_aux.c: since procps-ng 4.0.5, PIDS_VAL() takes 3 arguments, not 4 Cavitt, Jonathan
2025-01-04 21:44   ` Thomas Petazzoni
2025-01-06 17:42     ` Lucas De Marchi
2025-01-09 14:45       ` Kamil Konieczny
2025-01-03 23:44 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-01-03 23:47 ` ✓ i915.CI.BAT: " Patchwork
2025-01-04  2:27 ` ✗ i915.CI.Full: failure " Patchwork
2025-01-04  6:48 ` ✗ Xe.CI.Full: " Patchwork
2025-01-07 19:54 ` [PATCH i-g-t] " Kamil Konieczny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250103222628.4069004-1-thomas.petazzoni@bootlin.com \
    --to=thomas.petazzoni@bootlin.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox