Subject: Emulation of Ultrix signal handlers
To: None <port-pmax@NetBSD.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 01/03/1996 05:25:56
Hi,
Does anyone know if Ultrix signal emulation -- callouts from
the kernel to an emul_ultrix process's signal handler, and
then returning -- ever worked properly?
I'm finding the following (emacs-19's wakeup.c) works
fine as a native binary, but if compiled for Ultrix,
ktrace shows it gets a SIGLARM but then gets a SIGILL
before returning from (or executing?) the handler.
1834 wakeup CALL setitimer(0,0x7ffffa10,0)
1834 wakeup RET setitimer -4176/0xffffefb0
1834 wakeup CALL sigsuspend(0)
1834 wakeup RET sigsuspend -1 errno 4 Interrupted system call
1834 wakeup PSIG SIGALRM caught handler=0x401930 mask=0xfffefeff code=0x0
1834 wakeup PSIG SIGILL SIG_DFL
1834 wakeup NAMI "wakeup.core"
The recorded PC in the corefile is above the user stack, which
suggests that delivery of the signal (or returning from it)
is broken.
I thought this used to work, but maybe not...
/* Program to produce output at regular intervals. */
#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
struct tm *localtime ();
void
main (argc, argv)
int argc;
char **argv;
{
int period = 60;
time_t when;
struct tm *tp;
if (argc > 1)
period = atoi (argv[1]);
while (1)
{
/* Make sure wakeup stops when Emacs goes away. */
if (getppid () == 1)
exit (0);
printf ("Wake up!\n");
fflush (stdout);
/* If using a period of 60, produce the output when the minute
changes. */
if (period == 60)
{
time (&when);
tp = localtime (&when);
sleep (60 - tp->tm_sec);
}
else
sleep (period);
}
}