|
From: Alexander S. <as...@es...> - 2002-05-30 19:38:39
|
Hi! (sorry for imperfect English) I am running MSM-UNIX 4.3.0 for SCO under iBCS2. It is work fine mainly. However I have investigate that sigsuspend implementation in iBCS is _incorrect_. Although sigsuspend returns EINTR when signal arrives, signal handlers are not invoked. Probably similar problem affects sigpause emulation too. As far as I can see linux-abi contains almost the same abi_sigsuspend code (http://www.kernel.org/pub/linux/kernel/people/hch/linux-abi/v2.4/linux-abi-2.4.18.0.patch.gz) So I believe my idea & code below will be useful for linux-abi developers. What do you think ? ------------------------------------------------------------------------------ [signal.c] #ifndef __sparc__ int abi_sigsuspend(struct pt_regs * regs) { unsigned long * set; unsigned long oldset; old_sigset_t newset; int error; #if defined(EMU_BSD) && defined(PER_BSD) if (personality(PER_BSD)) { oldset = get_syscall_parameter (regs, 0); } else #endif { set = (unsigned long *)get_syscall_parameter (regs, 0); error = get_user(oldset, set); if (error) return error; } newset = map_bitvec(oldset, current->exec_domain->signal_map); #ifdef IBCS_TRACE if ((ibcs_trace & TRACE_SIGNAL) || ibcs_func_p->trace) printk("iBCS: sigsuspend oldset, newset = %lx %lx\n", oldset, newset); #endif { #if 0 extern do_sigpause(unsigned int, struct pt_regs *); return do_sigpause(newset, regs); #endif } // modby assur { volatile struct pt_regs *sregs; #define alloca(size) __builtin_alloca(size) // allocate sregs on our stack sregs = (struct pt_regs*)alloca(sizeof(struct pt_regs)); *sregs = *regs; // initialize it sregs->ebx = 0; // modify according linux-syscall conventions sregs->ecx = oldset; sregs->edx = newset; // (mask) error = SYS(sigsuspend)(); if (regs->esp != sregs->esp) // frame created on user stack { char *sigframe = (char*)(sregs->esp); // see setup_frame() // sorry, offset_of(struct sigframe, sc) hardcoded as 8 struct sigcontext *sc = (struct sigcontext*)(sigframe + 8); sc->ebx = regs->ebx; // restore altered registers sc->ecx = regs->ecx; sc->edx = regs->edx; *regs = *sregs; // invoke signal-handler } } return error; } #endif /* __sparc__ */ ------------------------------------------------------------------------------ WBR Alexander |