-/* $OpenBSD: sys_futex.c,v 1.4 2017/08/13 20:26:33 guenther Exp $ */
+/* $OpenBSD: sys_futex.c,v 1.5 2017/12/19 16:41:43 deraadt Exp $ */
/*
* Copyright (c) 2016-2017 Martin Pieuchot
struct futex *
futex_get(uint32_t *uaddr, int flag)
{
+ struct proc *p = curproc;
struct futex *f;
rw_assert_wrlock(&ftlock);
LIST_FOREACH(f, &ftlist, ft_list) {
- if (f->ft_uaddr == uaddr && f->ft_pid == curproc->p_p->ps_pid) {
+ if (f->ft_uaddr == uaddr && f->ft_pid == p->p_p->ps_pid) {
f->ft_refcnt++;
break;
}
f = pool_get(&ftpool, PR_WAITOK);
TAILQ_INIT(&f->ft_threads);
f->ft_uaddr = uaddr;
- f->ft_pid = curproc->p_p->ps_pid;
+ f->ft_pid = p->p_p->ps_pid;
f->ft_refcnt = 1;
LIST_INSERT_HEAD(&ftlist, f, ft_list);
}