[comp.os.minix] Exception handling in Minix

usenet@cps3xx.UUCP (Usenet file owner) (05/05/89)

	I have been using Minix 1.2 to teach the OS course and found the
strange behaviour of signal handling under Minix (w.r.t., a Unix
system). Here is segment of code, run under both Minix and Unix:

	#include <signal.h>

	int (*old)();
	main()
	{
	 int onalarm();

	 alarm(5);
	 old = signal(SIGALRM, onalarm);
	 while(old != SIG_IGN)
	      printf("no signal yet\n");
	 printf("\n executed after handling the signal\n");
	}

	onalarm()
	{
	 printf("just got the alarm\n");
	 old = SIG_IGN;
	}

1. The last printf in main module is never executed under Minix, which
implies that program terminates (exists) no matter what one tries. It
does seem to work with if one decides to use "setjmp" and "longjmp"
constructs. Is it supposed to work this way?

2. Under Unix the last printf in the main module is executed, that is,
it is possible to handle exceptions without resorting to "setjmp" and
"longjmp" constructs.

- ishwar rattan (rattan@frith.egr.msu.edu)
		(3cqbjoz@cmuvm.bitnet)