From 9b7850d511c2c910abfb42ece20650b97fba5a72 Mon Sep 17 00:00:00 2001 From: Valery Ushakov Date: Sat, 9 Mar 2019 22:03:59 +0300 Subject: Work around a problem on macppc with kernel semaphores. NetBSD/macppc 7 and later seems to have a bug in kernel based pthread semaphores. When running emu interactively shell would forever hang in sem_wait() after the first interactive command. I added sem_getvalue() after sem_init() as a debugging aid to get the semaphore id in ktrace output and it magically fixed the problem. For now just leave it here as a workaround under appropriate ifdef. --- emu/port/kproc-pthreads.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'emu/port/kproc-pthreads.c') diff --git a/emu/port/kproc-pthreads.c b/emu/port/kproc-pthreads.c index a15a7cd3..c6caded6 100644 --- a/emu/port/kproc-pthreads.c +++ b/emu/port/kproc-pthreads.c @@ -122,6 +122,12 @@ kproc(char *name, void (*func)(void*), void *arg, int flags) panic("kproc: no memory"); os->self = 0; /* set by tramp */ sem_init(&os->sem, 0, 0); +#if defined(__NetBSD__) && defined(__powerpc__) + { /* XXX: Work around a problem on macppc with kernel semaphores. */ + int val; + sem_getvalue(&os->sem, &val); + } +#endif p->os = os; if(flags & KPDUPPG) { -- cgit v1.2.3