Commit Graph

42 Commits

Author SHA1 Message Date
355768c564 Add overloads to dump_stacktrace
Using a function while debugging helps to see where various functions are
called from.
2018-08-20 13:56:59 +03:00
0685276764 Use correct functions in maxutils CMake files
The headers and the static library were installed unconditionally.
2018-08-20 13:56:58 +03:00
40a5ae81c7 MXS-2008 Store worker as MXB_WORKER* and not void* 2018-08-20 11:15:14 +03:00
e0cb11151f MXS-2008 Move maxscale/worker.h to maxbase/worker.h 2018-08-20 11:15:14 +03:00
932956d5f6 MXS-2008 Add maxbase/poll.[h|hh]
Remove maxscale/poll_core.h
2018-08-20 11:15:14 +03:00
aaad63ee5e MXS-2008 Move content of maxscale/platform.h to maxbase/cdefs.h
No good reason for keeping that platform adjustments anywhere
else but in cdefs.h.
2018-08-20 11:15:14 +03:00
9510a3ae1a Use normal asserts in log.cc
The logger can't use the asserts that log messages as it introduces a
cyclical dependency on the logger itself.
2018-08-17 18:09:51 +03:00
9b199cfb50 Remove duplicate CMakeLists.txt entry
maxutils/maxbase/src/test/CMakeLists.txt
2018-08-17 16:21:58 +03:00
b82822a4b0 MXS-2017 Move maxscale::Semaphore to maxbase::Semaphore 2018-08-17 15:57:44 +03:00
d8255d0cac MXS-2017 Move maxscale::Semaphore to maxbase::Semaphore 2018-08-17 15:53:54 +03:00
25c81b118d Rename conflicting test 2018-08-17 15:02:03 +03:00
c7a6d75ab9 MXS-2014 Address review issues 2018-08-17 10:59:37 +03:00
15bf481120 MXS-2014 Allow the header and footer to be adjusted 2018-08-17 10:59:37 +03:00
4388b8517e MXS-2014 Use standard assert in Logger 2018-08-17 10:59:37 +03:00
cfdfff46ae MXS-2014 Add skeleton test for mxb::Log 2018-08-17 10:59:37 +03:00
12e8f28907 MXS-2014 Add mxb::Log class for convenience
In tests, the log can now be setup as

    int main()
    {
        mxb::Log log;
        ...
    }

That will initialize the log so that it logs to a file called
<program-name>.log in the current directory and finalize it
when the program exits.
2018-08-17 10:59:37 +03:00
be986d366a MXS-2014 Handle default OOM message properly 2018-08-17 10:59:37 +03:00
876cf7c86f MXS-2014 Temporarily fix broken token pasting 2018-08-16 11:24:01 +03:00
19684deb69 MXS-2014 Init and finish properly
If any part of initalization fails, no resources are held.
At finalization, release all resources.

Also re-implement recent changes made to log_manager.cc that
did not automatically move over to log.cc.
2018-08-16 11:09:30 +03:00
a586aa13c4 MXS-2014 Add proper OOM support
Not that I think it ever will be needed...
2018-08-16 09:59:43 +03:00
85b68c439a MXS-2014 Still more cleanup of maxbase/log.h 2018-08-16 09:59:43 +03:00
8ae2997c4e MXS-2014 Remove separate log_write() function 2018-08-16 09:59:43 +03:00
5b46d815e4 MXS-2014 Move message status checking into MessageRegistry 2018-08-16 09:59:43 +03:00
79b292dc39 MXS-2014 Additional cleanup of log.cc 2018-08-16 09:59:43 +03:00
5b70c7605c MXS-2014 Some cleanup of log.cc
Unused stuff removed and unit variables collected into this_unit
structure.
2018-08-16 09:59:43 +03:00
0c479b5d13 MXS-2014 Enable asserts in log.cc 2018-08-16 09:59:43 +03:00
6b6bbceb6e MXS-2014 Add maxbase/assert.h
Basically a copy of maxscale/debug.h, but with some name changes.

- ss_dassert      -> mxb_assert
- ss_info_dassert -> mxb_assert_message
- ss_debug        -> MXB_AT_DEBUG
2018-08-16 09:59:43 +03:00
52e6e10e28 MXS-2014 Remove duplicate function
Two functions that essentially did the same thing, but had
slightly different name.
2018-08-16 09:58:00 +03:00
b4912a942f MXS-2014 Add missing MXB_[BEGIN|END]_DECLS 2018-08-16 09:58:00 +03:00
a191ed85a2 MXS-2014 Expose everything needed by the MaxScale log manager 2018-08-16 09:58:00 +03:00
1a6eb8165a MXS-2014 Add log.[h|cc] to maxbase
Almost a verbatim copy of log_manager.[h|cc] with mxs changed
to mxb. The changes allow the MaxScale log manager to be moved
on top of this implementation.
2018-08-16 09:58:00 +03:00
17418572f9 MXS-2014 Move maxscale/jansson.h to maxbase/jansson.h 2018-08-16 09:58:00 +03:00
be4f9125f0 Fix mxb_strerror
The function should not be an inline function with a static variable. This
appears to cause problems on at least Debian Wheezy and is likely to cause
odd behavior on other platforms.

Also renamed the file to <maxbase/string.h> to better mirror how the
<string.h> file behaves.
2018-08-15 14:58:46 +03:00
f3f802cabe MXS-2008 Move maxscale/atomic.h to maxbase/atomic.h 2018-08-15 08:44:39 +03:00
d53bc9d3be MXS-2008 Move maxscale/semaphore.h to maxbase/semaphore.h 2018-08-15 08:41:45 +03:00
c543525c1b MXS-2005: Move Logger into maxutils
Moved the logger into the maxutils library as it is a generic
utility. Also moved mxs_strerror into it as it depends on it.
2018-08-14 14:57:34 +03:00
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
c32e6a7c3f Add stacktrace generation to maxbase
The stacktrace generation is now a part of the maxbase library. The code
is the same code that was previously defined in gateway.cc as a part of
MaxScale.
2018-06-22 13:59:57 +03:00
7254a7c525 Make maxutils a standalone library
The only way to cleanly separate the maxutils library from the MaxScale
CMake project is to make it a standalone CMake project. With the help of
ExternalProject, it should be relatively easy to use.
2018-06-22 13:59:57 +03:00
9c6c0a4d95 Add common headers to maxbase
To be included first in all headers. Defined and included common
ground and provides a place when one can affect all code.
2018-06-20 09:53:19 +03:00
d2e1cfdf4e MXS-1777 fix CMakeLists.txt for utility library
Last minute directory changes were not fully applied in CMakeLists.txt
2018-06-18 15:27:44 +03:00
2514c99d9e MXS-1777 Create new utility library
The purpose of this library is to create a utility library that is not
dependent on maxscale for use in both maxscale and system test, and
possibly other apps. As time permits general purpose utilities from
maxscale-common can be moved to the new library.

Here are answers to questions you may have:
- A top level directory "maxutils" contains the libraries. The current
  structure is simply maxutils/maxbase. Each library has an 'include' and
  a 'scr' directory where public headers exist in 'include'
- Code is in a namespace with the same name as the directory.
- Headers are included like this: `#include <maxbase/stopwatch.hh>`
- In case the library is published on its own, the include directives stay
  the same (headers would be in /usr/include/maxutil, for example).
- I am not advocating many small libraries. But if some larger library
  is written, say a general purpose statemachine, it would not pollute
  util/maxutil but go to util/maxsm.
  Another example: Worker. It is a larger concept, but used so widely in
  code that it could very well live in maxutil.

NOTE: this was previously Review Request #6245.
2018-06-15 12:05:57 +03:00