All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] tst_clone: Fix child detection on sparc
@ 2026-09-29  8:42 Anders Roxell
  2026-09-29 11:16 ` [LTP] " linuxtestproject.agent
  2026-09-29 14:21 ` [LTP] [PATCH v2] " Petr Vorel
  0 siblings, 2 replies; 6+ messages in thread
From: Anders Roxell @ 2026-09-29  8:42 UTC (permalink / raw)
  To: ltp

On sparc the clone syscall does not return 0 in the child. It returns
the parent pid, so the child thinks it is the parent.

Save the pid before the clone and compare it after.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 lib/tst_clone.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/tst_clone.c b/lib/tst_clone.c
index 296cd40ac0a0..d7f005a2d2a5 100644
--- a/lib/tst_clone.c
+++ b/lib/tst_clone.c
@@ -20,6 +20,9 @@ pid_t tst_clone(const struct tst_clone_args *tst_args)
 	};
 	int flags;
 	pid_t pid = -1;
+#ifdef __sparc__
+	pid_t parent_pid = tst_getpid();
+#endif
 
 	tst_flush();
 
@@ -44,5 +47,10 @@ pid_t tst_clone(const struct tst_clone_args *tst_args)
 	if (pid == -1)
 		return -2;
 
+#ifdef __sparc__
+	if (pid == parent_pid)
+		pid = 0;
+#endif
+
 	return pid;
 }
-- 
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-30 19:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29  8:42 [LTP] [PATCH v2] tst_clone: Fix child detection on sparc Anders Roxell
2026-09-29 11:16 ` [LTP] " linuxtestproject.agent
2026-09-29 14:21 ` [LTP] [PATCH v2] " Petr Vorel
2026-09-30 12:16   ` Anders Roxell
2026-09-30 13:53     ` Petr Vorel
2026-09-30 19:42       ` Anders Roxell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.