Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!dogie.macc.wisc.edu!uwvax!tank!eecae!cps3xx!usenet From: usenet@cps3xx.UUCP (Usenet file owner) Newsgroups: comp.os.minix Subject: Exception handling in Minix Keywords: Minix 1.2, signal handling, exception handling Message-ID: <2859@cps3xx.UUCP> Date: 5 May 89 14:56:35 GMT Expires: 22 May 89 04:00:00 GMT References: None Reply-To: rattan@frith.egr.msu.edu () Followup-To: rattan@frith.egr.msu.edu Distribution: na Organization: Michigan State University Lines: 36 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 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)