Today was a quite good day. I had time to work the full day on rsyslog and could go for the complex things. To do them, I also had to add some more plumbing, which hopefully will also enable me to do other things much quicker in the future. For example, I have added a full-fledged, keyed linked list class today. I think that this class will most probably serve me again on several occasions. It is very generic and should be applicable to many more code pathes where linked lists are needed. I will not migrate the other linked lists right away, but in the long term this will most probably happen (and resulting in smaller code size for the same functionality).
I have also improved internal error handling and support macros. I have finally arrived at a stage where there is a well defined way (based on srRetVal data type) by which all functions communicate between each other. This includes something like finalizers. It works pretty neat. Of course, lot’s of code is still to be changed. But a lot is already done. I think this system also greatly improves code reliability, as all error states are consistently handled and reported to upper layers. I already see benefit from that in practice. For example, there was the problem that up until now config line parsing errors did not report line numbers. This was quite hard to obtain with the old code. Now, the high-level handler gets a neat error state and if it is an error, the high-level function spits out the line number – mission accomplished. Oh, what a joy when there is a well-designed and solid code base ;) I guess I will enjoy similar benefits more often in the future.
Here is the work log for today:
- moved doGetGID() to cfsysline.c
- moved umask & file/dir creation mode parsing to cfsysline.c
- added macro for easy and consistent check of iRet return value
- moved the SetCCEscapeCharacter config file directive to cfsysline.c and also generalized it for further use while doing so
- added doGetInt() to cfsysline.c and adapted dynaFileChaceSize handler to use it
- added macro to consistently define iRet
- added macro to abort a function and go to finalizer
- added output of config file line number when a parsing error occured
- moved code to open config file into separate function processConfFile()
- fixed bug in objomsr.c that caused program to abort in debug mode with an invalid assertion (in some cases)
- moved debug printf code out of init() into its own function
- added doCustomHdlr() to cfsysline.c – this completes implementing functions for canned handlers.
- added a generic linked list object (files linkedlist.h/c)
- fixed a typo that caused the default template for MySQL to be wrong. thanks to mildew for catching this.
- prepared cfsysline.c for integration into output modules
- changed modInit() interface to contain pointer to host-function query method
- added interface to register a cfsysline command handler (basic functionality)
- got the basic code in place to create an in-memory list of cfsysline handlers (omfile.c used as testing case) — not yet in active code
- omfile.c now uses the new table-driven cfsysline system
- added configuration file command $DebugPrintModuleList and $DebugPrintCfSysLineHandlerList
- all cfsysline directives now use new table-driven cfsysline system except for $ResetConfigVariables
- $ResetConfigVariables now also works via the table-driven sytem. However, I need to fix an issue with loading default settings when syslogd is started or HUPed