On Mon, 22 Nov 2004 14:27:40 +0530, Jagadeesh Bhaskar P <[EMAIL PROTECTED]> wrote: > > You are generating a divide by zero exception (on i386) which is a > > fault (it means the instruction is restartable). So what happens is > > you catch an exception and print and return. The same code is > > restarted again. so processor gets exception again and again. > > If the fault was not attached to a function written by me, and leaving > it to be handled by the kernel, there was no problem. How can that > happen? Shouldnt the kernel restart the instruction in that case also. > Why didnt that happen? > > -- > With regards, > > Jagadeesh Bhaskar P > R&D Engineer > HCL Infosystems Ltd > Pondicherry > INDIA
In UNIX and like, the exceptions generate UNIX signals. IEEE POSIX have defined what to do on generation of signals. The signal may have default action, run user 's signal handler. For SIGFPE signal, The default action is Abnormal termination of the process. But when you set your handler, it does not terminate but runs your handler. After returning from your handler it again tries to execute the faulting instruction and signal is generate again and so on. BTW: For UNIX programming, Advanced UNIX programming by richard stevens is the Best book (i have ever seen). Regards Manish -- Manish Regmi - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs