I committed code to re-architect bmc-info. Please ensure that this
re-architecture is carried into atleast the new tools (ipmi-pef,
ipmi-chassis, etc.) and when you have time, try to carry them over to
ipmi-sel, ipmi-sensors, etc. I will work on the other tools when I have
time as well. They are for later hostrange support in the tools. In
particular, the re-architecture requires:
A) Removing all globals and putting any program information into a
structure that can be passed around to all functions doing the "core"
grunt work of the tool. This sets up thread safety for later.
B) Move all "core code" out of main(). Create a function that can be
called by main() to do the entire body of work for the tool. This
function should be passed the program structure from 'A'. The function
should return the exit code it would like main to exit with. This
re-architecture sets up the pthread_create() call for later.
C) Remove all exit() calls in the "core code" and ensure the only time the
program exits is in main. Errors should be handled by return -1 or NULL
etc. and propagated back into the function created by 'B', of which the
function in 'B' can decide what the exit code for the program should be.
This prevents early termination based on errors and ensures the correct
exit code for each thread can be carried until the end.
Please see the changes to bmc-info and you'll see what I mean.
High Performance Systems Division
Lawrence Livermore National Laboratory
Freeipmi-devel mailing list