RE: 4GL question
Posted in 2000
Ok, 4GL must be catching the error, cleaning up and then exiting. My mistake for not testing with 4GL.. If you right a C program which does not catch signals it behaves as I described. The following program implements what I imagine informix does. Program 1: #include<stdio.h> #include<signal.h> void leave(); main(int argc, char *argv[]) { signal(15, leave); getchar(); return(0); } void leave() { /* code to release memory ... */ exit(1); } This program will return a 1 when it gets sent a kill -15 To be honest I expected the following program to be what informix had implemented. There very well may be reasons which prevented them from doing this that I am not aware of. My reasoning is that the user should be able to discover the fact that this was an abnormal termination. Program 2: #include<stdio.h> #include<signal.h> void leave(); main(int argc, char *argv[]) { signal(15, leave); getchar(); return(0); } void leave() { /* code to release memory ... */ kill(getpid(), 15); } This returns 143. This is the program my orginal examples came from Program 3: #include<stdio.h> main(int argc, char *argv[]) { getchar(); return(0); } Some signals are not catchable. kill -9 for example can not be caught, so will always give you a return code indicating abnormal termination. I do not know enough about 4gl to tell you if you have any options. If you have any other questions or would like more information please ask Will >===== Original Message From "Carlson@WHSmith" <carlson1@bellsouth.net> ===== >William Rice wrote: >> >> I am not sure if you are asking for a way to specify your own return >> code in the case of a SIGSEG or whatever, or if you are asking >> how to determine if you died due to an uncaught signal. >> > >Well, since you volunteered. . . . . > >I've been able to determine that on an HPUX system, a regular kill (15) >will produce a $? of 1. Kill -9 will return 137. Kill -14 returns >zero. I guess it all depends on what the cause of death was. > >I also know that I an able to control the return code from the program >by using 'exit program nnn'. That would help for various SQL errors and >such. > >But your first statement caught my curiosity. How can you specify you >own return code in the case of an abnormal termination (kill, system >issue, etc)? > > >-- >John Carlson >Informix DBA >WHSmith USA > >#include std_disclaimer.h /* These are my opinions, not my company's >opinion */ ------------------------------------------------------------ This e-mail has been sent to you courtesy of OperaMail, as a free service from Opera Software, makers of the award-winning Web Browser, Opera. Visit us at http://www.opera.com/ or our portal at: http://www.myopera.com/ Your free e-mail account is waiting at: http://www.operamail.com/ ------------------------------------------------------------