-/* $OpenBSD: drm_linux.c,v 1.97 2023/03/15 08:24:56 jsg Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.98 2023/06/01 10:21:26 claudio Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
int
wake_up_process(struct proc *p)
{
+ int s, rv;
+
+ SCHED_LOCK(s);
atomic_cas_ptr(&sch_proc, p, NULL);
- return wakeup_proc(p, NULL);
+ rv = wakeup_proc(p, NULL, 0);
+ SCHED_UNLOCK(s);
+ return rv;
}
void
-/* $OpenBSD: kern_synch.c,v 1.191 2023/02/15 20:43:41 mvs Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.192 2023/06/01 10:21:26 claudio Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
}
int
-wakeup_proc(struct proc *p, const volatile void *chan)
+wakeup_proc(struct proc *p, const volatile void *chan, int flags)
{
- int s, awakened = 0;
+ int awakened = 0;
+
+ SCHED_ASSERT_LOCKED();
- SCHED_LOCK(s);
if (p->p_wchan != NULL &&
((chan == NULL) || (p->p_wchan == chan))) {
awakened = 1;
+ if (flags)
+ atomic_setbits_int(&p->p_flag, flags);
if (p->p_stat == SSLEEP)
setrunnable(p);
else
unsleep(p);
}
- SCHED_UNLOCK(s);
return awakened;
}
int s;
SCHED_LOCK(s);
- if (wakeup_proc(p, NULL))
- atomic_setbits_int(&p->p_flag, P_TIMEOUT);
+ wakeup_proc(p, NULL, P_TIMEOUT);
SCHED_UNLOCK(s);
}
if (p->p_stat != SSLEEP && p->p_stat != SSTOP)
panic("wakeup: p_stat is %d", (int)p->p_stat);
#endif
- if (wakeup_proc(p, ident))
+ if (wakeup_proc(p, ident, 0))
--n;
}
SCHED_UNLOCK(s);
-/* $OpenBSD: proc.h,v 1.340 2023/04/25 18:14:06 claudio Exp $ */
+/* $OpenBSD: proc.h,v 1.341 2023/06/01 10:21:26 claudio Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
void setpriority(struct proc *, uint32_t, uint8_t);
void setrunnable(struct proc *);
void endtsleep(void *);
-int wakeup_proc(struct proc *, const volatile void *);
+int wakeup_proc(struct proc *, const volatile void *, int);
void unsleep(struct proc *);
void reaper(void *);
__dead void exit1(struct proc *, int, int, int);