From 6fc1990597519c1955957b9e1a1f8ecc8aa42970 Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Thu, 15 Jan 2026 19:32:01 +0000 Subject: [PATCH] thread_group: pgid: inherit from parent Inherit the process-group ID from the parent. If there is no parent specified then the pgid is the same as the tgid. --- src/process/thread_group/builder.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/process/thread_group/builder.rs b/src/process/thread_group/builder.rs index 49b3d41..87f89e5 100644 --- a/src/process/thread_group/builder.rs +++ b/src/process/thread_group/builder.rs @@ -62,7 +62,12 @@ impl ThreadGroupBuilder { pub fn build(self) -> Arc { let ret = Arc::new(ThreadGroup { tgid: self.tgid, - pgid: SpinLock::new(Pgid(self.tgid.value())), + pgid: SpinLock::new( + self.parent + .as_ref() + .map(|x| *x.pgid.lock_save_irq()) + .unwrap_or_else(|| Pgid(self.tgid.value())), + ), sid: SpinLock::new(Sid(self.tgid.value())), parent: SpinLock::new(self.parent.as_ref().map(Arc::downgrade)), umask: SpinLock::new(self.umask.unwrap_or(0)),