-/* $OpenBSD: kern_exit.c,v 1.230 2024/08/06 18:41:20 claudio Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.231 2024/08/11 15:10:53 mvs Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
PS_ISPWAIT);
wakeup(pr->ps_pptr);
}
+
+ /* Wait for concurrent `allprocess' loops */
+ refcnt_finalize(&pr->ps_refcnt, "psdtor");
}
/* unlink ourselves from the active threads */
-/* $OpenBSD: kern_fork.c,v 1.261 2024/08/06 08:44:54 claudio Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.262 2024/08/11 15:10:53 mvs Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
void
process_initialize(struct process *pr, struct proc *p)
{
+ refcnt_init(&pr->ps_refcnt);
+
/* initialize the thread links */
pr->ps_mainproc = p;
TAILQ_INIT(&pr->ps_threads);
-/* $OpenBSD: kern_sysctl.c,v 1.436 2024/08/08 15:02:36 bluhm Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.437 2024/08/11 15:10:53 mvs Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
/* not the pid we are looking for */
continue;
}
+
+ refcnt_take(&pr->ps_refcnt);
+
matched = 1;
fdp = pr->ps_fd;
if (pr->ps_textvp)
FILLIT(fp, fdp, i, NULL, pr);
FRELE(fp, p);
}
+
+ refcnt_rele_wake(&pr->ps_refcnt);
+
/* pid is unique, stop searching */
if (arg >= 0)
break;
/* not the uid we are looking for */
continue;
}
+
+ refcnt_take(&pr->ps_refcnt);
+
fdp = pr->ps_fd;
if (fdp->fd_cdir)
FILLIT(NULL, NULL, KERN_FILE_CDIR, fdp->fd_cdir, pr);
FILLIT(fp, fdp, i, NULL, pr);
FRELE(fp, p);
}
+
+ refcnt_rele_wake(&pr->ps_refcnt);
}
break;
default:
-/* $OpenBSD: proc.h,v 1.367 2024/08/06 08:44:54 claudio Exp $ */
+/* $OpenBSD: proc.h,v 1.368 2024/08/11 15:10:53 mvs Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
* T itimer_mtx
*/
struct process {
+ struct refcnt ps_refcnt;
+
/*
* ps_mainproc is the original thread in the process.
* It's only still special for the handling of