Download raw body.
Unlock getpgrp(2)
I don't see a problem with this.
Vitaliy Makkoveev <mvs@openbsd.org> wrote:
> `ps_pgrp' is protected by both kernel lock and `ps_mtx' mutex, so only
> one is enough for read only access. `pg_id' has the type of pid_t.
>
> The corresponding enternewpgrp() sets `ps_pgrp' to the initialized new
> one with both locks held.
>
> Index: sys/kern/kern_prot.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/kern_prot.c,v
> diff -u -p -r1.84 kern_prot.c
> --- sys/kern/kern_prot.c 3 Dec 2025 17:05:53 -0000 1.84
> +++ sys/kern/kern_prot.c 8 Jun 2026 13:13:21 -0000
> @@ -94,7 +94,9 @@ int
> sys_getpgrp(struct proc *p, void *v, register_t *retval)
> {
>
> + mtx_enter(&p->p_p->ps_mtx);
> *retval = p->p_p->ps_pgrp->pg_id;
> + mtx_leave(&p->p_p->ps_mtx);
> return (0);
> }
>
> Index: sys/kern/syscalls.master
> ===================================================================
> RCS file: /cvs/src/sys/kern/syscalls.master,v
> diff -u -p -r1.272 syscalls.master
> --- sys/kern/syscalls.master 2 Jun 2026 21:46:21 -0000 1.272
> +++ sys/kern/syscalls.master 8 Jun 2026 13:13:21 -0000
> @@ -183,7 +183,7 @@
> gid_t *gidset); }
> 80 STD { int sys_setgroups(int gidsetsize, \
> const gid_t *gidset); }
> -81 STD { int sys_getpgrp(void); }
> +81 STD NOLOCK { int sys_getpgrp(void); }
> 82 STD { int sys_setpgid(pid_t pid, pid_t pgid); }
> 83 STD NOLOCK { int sys_futex(uint32_t *f, int op, int val, \
> const struct timespec *timeout, uint32_t *g); }
>
Unlock getpgrp(2)