[igt-dev] [PATCH i-g-t] Replaced setpgrp() with setpgid() for standardization in BSD systems

Jake Freeland jake at technologyfriends.net
Wed Sep 28 19:35:52 UTC 2022


The BSD and GNU versions of setpgrp() differ in their parameter
conventions. To avoid this convolution, setpgrp() can be safely
replaced with setpgid() which is standard in both BSD and GNU
libc.

Signed-off-by: Jake Freeland <jfree at freebsd.org>
---
 lib/igt_aux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index d7e2714f..ba2d52e8 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -325,10 +325,10 @@ void igt_fork_signal_helper(void)
 	 * and we send the signal at exactly the wrong time).
 	 */
 	signal(SIGCONT, sig_handler);
-	setpgrp(); /* define a new process group for the tests */
+	setpgid(0, 0); /* define a new process group for the tests */
 
 	igt_fork_helper(&signal_helper) {
-		setpgrp(); /* Escape from the test process group */
+		setpgid(0, 0); /* Escape from the test process group */
 
 		/* Pass along the test process group identifier,
 		 * negative pid => send signal to everyone in the group.
-- 
2.37.3



More information about the igt-dev mailing list