kjb_init - Performs some KJB library initialization


#include "l/l_init.h"

Example compile flags (system dependent):
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 

int kjb_init(void);


This routine performs some KJB library initialization. As far as possible, I try to minimize the reliance of the library routines on any initialization. Thus mall routines should work in some fashion if this routine is Hence this routine is not actually needed. However, it does provide a few facilities which are recomended, and can only be ecomically be provided near program startup. It is also desirable to have a hook for future developments which may require some additional initialization. Some details as to the current effects are provided here so that callers can decide if they are better off without some subset of the effects, and proceed acordingly. Currently we: Start a process to handle system routines. Doing it this way reduces forking overhead on many systems. 2) On some systems, we request that floating point exceptions be trapped. 3) We set up some signal traps. Some routines put the terminal into a state which needs to be reset before exit. This is arranged for normal exits, but if the program is terminated by a signal, then it is best to clean up first. Otherwise the user can use a CTL-C to kill a program, and then be left a terminal that is hard to comunicate with (whether this actually occurs depends on the shell, it is the case for csh--but not tcsh). There are also several other cleanup activities which we would like to have done. Thus we trap most ways to exit the program. I also find it useful to modify the behaviour of program crashes. If it is production code, then a bug log is produced instead of a core dump. If the code is a development version (compiled with TEST), then some clean up is done before dumping core. This makes it so that when there are multiple processes running, we get a clean core dump.


On success, return value is NO_ERROR. A return value of ERROR indicates a failure performing one or more setup tasks, such as starting the new process or manipulating the signal handlers. The cause of the error is written to the kjb_error message.


kjb_cleanup, add_cleanup_function, kjb_abort, set_default_abort_trap, set_sig_trap


This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.


Kobus Barnard


Kobus Barnard