Commit Graph

358 Commits

Author SHA1 Message Date
Angus Salkeld
908bdfd172 IPC: add a new function to get (and alloc) the extended stats.
This should handle any further additions to the stats
as the library allocs the struct.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 20:20:29 +10:00
Angus Salkeld
e4cc803a52 TEST: Use /bin/sh not /bin/bash
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 11:41:11 +10:00
Angus Salkeld
32f206d5d7 TEST: check for lost shared mem on bsd too
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 11:36:36 +10:00
Angus Salkeld
c566421df9 rb: cleanup the semaphores
- the way they are selected
- rpl_sem.c the error handling

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 10:39:43 +10:00
Angus Salkeld
7c2e632be0 IPC: fix retrying of partial recv's and sends.
Move to send() instead of sendmsg() as it's easier
to track resending partial messages.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-03 21:24:02 +10:00
Angus Salkeld
9f09aba8dd IPC: handle a connection disconnect from the server better
Only problem with SOCKET.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-02 10:15:19 +10:00
Angus Salkeld
78fb4ad682 IPC: make it possible to send events in the connected callback.
This was only a problem with QB_IPC_SOCKET.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-01 20:09:21 +10:00
Angus Salkeld
6b7da3f531 Add the event queue length to the connection stats.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-01 13:22:16 +10:00
Angus Salkeld
b29326a363 IPC: add a is_connected client side function.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-01 12:43:22 +10:00
Angus Salkeld
6263e2eea6 TEST: improve the tracing in the ipc tests.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-30 15:49:42 +10:00
Angus Salkeld
aca7bec0e8 TEST: add a test to confirm we get the events we send.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-30 10:04:54 +10:00
Angus Salkeld
7bd8901bdf TEST: reuse send_and_check for events.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-30 09:28:28 +10:00
Angus Salkeld
d80f218133 Handle a recv of size 0
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 21:57:49 +10:00
Angus Salkeld
1af214d91d Try and improve the portability on bsd variants.
Also add a QB_IPC_NATIVE type that selects the best ipc type available.

Signed-off-by: Angus <angus@anguss-mac-mini>
2012-03-24 22:43:37 +11:00
Angus Salkeld
157cec22a7 TEST: add a test to check the order of the jobs
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 19:33:35 +11:00
Angus Salkeld
df9ff8fdad TESTS: move the util tests into "slow-tests" (i.e. optional)
So this this test is timing sensitive and can easily fail on slow
build farm machines. So I have enabled it on the --enable-slow-tests
configure option and put this into ./check as the default.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-07 16:35:11 +11:00
Angus Salkeld
a4beed9bbf TEST: make the test_priority the same type as in the callsite
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-07 13:06:44 +11:00
Angus Salkeld
2ae58d2472 RB: fix test failure on ppc
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-07 11:37:12 +11:00
Angus Salkeld
bf35fb0e5a TEST: add some more signal tests.
-Make sure we only get one callback per signal
-Make sure we correctly delete a callback even if it has been
 put in the job queue.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-06 22:36:39 +11:00
Angus Salkeld
902e483b20 TEST: deal with mac's limited sed
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-05 19:23:57 +11:00
Angus Salkeld
623a32d81f TEST: properly clear the filters
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-05 17:07:28 +11:00
Angus Salkeld
e37f801170 LOOP: add qb_loop_timer_is_running()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-22 11:08:42 +11:00
Angus Salkeld
70f1eb8130 LOOP: add a function to delete jobs
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 22:18:43 +11:00
Angus Salkeld
504e000cb8 LOG: add a hostname %H format specifier.
This is useful when logging to file on a cluster.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 17:34:45 +11:00
Angus Salkeld
ff0d89721f LOG: Add qb_log_filter_fn_set()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 15:40:58 +11:00
Angus Salkeld
42de03038e clang: Remove unused code
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-14 17:27:26 +11:00
Angus Salkeld
8eb34862a5 TEST: make the ipc failure test closer to corosync's case.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-14 16:44:58 +11:00
Angus Salkeld
1e4b33c9cf LOOP: make it possible to pass in NULL as the default loop instance
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-10 14:47:49 +11:00
Angus Salkeld
293813552b Don't mix enums (QB_TRUE/TRUE)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:49 +11:00
Angus Salkeld
205336980c use random() not rand()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:49 +11:00
Angus Salkeld
ae682d2a78 TEST: make the loop ratelimit test more forgiving.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 17:45:42 +11:00
Angus Salkeld
9340221261 TEST: check for a single job causing a cpu spin
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-07 09:41:00 +11:00
Angus Salkeld
42d20b5090 Get coverity to ignore this warning.
"Using uninitialized element of array"

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-03 14:42:25 +11:00
Angus Salkeld
a95618ddd3 Fix some issues found by clang
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-03 14:37:37 +11:00
Angus Salkeld
63bdfd1b71 Add a split timer to the stopwatch.
This is just a re-work of Steve's sample patch.

You set the number of splits and whether they overwrite using
qb_util_stopwatch_split_ctl().

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-01 13:46:27 +11:00
The Quarterback Library Release Team
297970af03 TEST: Make sure the generated files have the correct include paths
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-01-26 22:10:14 +11:00
Angus Salkeld
27d2b0a882 LOG: make sure qb_log_from_external_source() takes priority into account.
Fixes: https://github.com/asalkeld/libqb/issues/28

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-24 23:08:39 +11:00
Angus Salkeld
f6c5c5179d Deprecate qb_util_set_log_function()
And remove uses of it from the test programs

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-24 16:00:05 +11:00
Angus Salkeld
29d193112a LOOP: allow a timer to be created without returning the handle
This is if the user does not plan to delete the timer.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-23 16:04:49 +11:00
Angus Salkeld
295f7e48bb IPC: check for the server liveness before disconnecting.
if the server is dead then is_connected will cause the resourses
to be properly cleaned up.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-21 22:05:50 +11:00
Angus Salkeld
e235412497 TESTS: add tests for signal handlers
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-18 22:30:35 +11:00
Angus Salkeld
2947797897 LOG: make sure the format is checked.
In case of log clashes (same file/lineno but in different directories.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-17 21:37:32 +11:00
Angus Salkeld
ec751144f7 TEST: make sure qb_log() can be called before init.
The log is dropped but it won't crash.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-17 14:35:21 +11:00
Angus Salkeld
08203eea66 Add a test to enforce standalone headers and protectors
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-16 22:22:50 +11:00
Angus Salkeld
39d85a8d1b TEST: change the script to .sh and generated c file to auto_
Just to make cleanup easier

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-16 22:18:39 +11:00
Angus Salkeld
477fac4e01 IPC: fix resource cleanup if the server dies
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-12 15:09:58 +11:00
Angus Salkeld
b32a027d5b ipc test: remove try again hack
This was needed because I didn't realise the timeout was broken.
(at least this works now)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-11 22:46:56 +11:00
Angus Salkeld
fdd4914ad6 Fix check_ipc.c formatting.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-11 22:44:42 +11:00
Angus Salkeld
46098d1cbe LOG: make it possible to pass in a NULL filename/function into qb_log_from_external_source()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-06 10:39:10 +11:00
Angus Salkeld
7ff28b99bc map: free unused leaf nodes
So if a node has no children and no value or notifier
then it is freed.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-05 13:37:24 +11:00
Fabio M. Di Nitto
9f5d0aebbb Fix some sparc test failures.
I (Angus) have changed some of Fabio's changes.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-22 13:56:20 +11:00
Angus Salkeld
ab3dc60f7f Merge some portability changes from the mingw branch
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-21 14:23:43 +11:00
Angus Salkeld
30ba4cee83 make -rt configurable (not needed on mac)
Thanks to Andrew Beekhof

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-19 22:12:08 +11:00
Angus Salkeld
413d3cf015 map: tweek the tests to better test ptrie
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-18 22:52:29 +11:00
Angus Salkeld
2da98acd42 MAP: add a notifier purely to allow the user to free memory.
At the moment if you have multiple notifiers it becomes impossible
to figure out when it is safe to free the values.

This new callback can only be added once and is called
once, making it better suited to freeing memory. It is
also called after the deleted and replaced notifiers.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-14 00:26:01 +11:00
Angus Salkeld
ef77398738 Fix errors found by api-sanity-autotest
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 17:16:19 +11:00
Angus Salkeld
e01b79883a map: enforce uniqueness of the notifiers based on (func,key,event,userdata)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 13:25:56 +11:00
Angus Salkeld
f644b5c1c6 Add tests for hash and skiplist notifications
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 11:14:31 +11:00
Angus Salkeld
b69ca79c7f By default don't build in the slow benchlog
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 11:12:27 +11:00
Angus Salkeld
c30b3ae8d8 TEST: add a test that reproduces issue/20
https://github.com/asalkeld/libqb/issues/20

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-10 09:27:45 +11:00
Angus Salkeld
e1e83aa746 Move simple-log.c to examples/
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-23 22:40:26 +11:00
Angus Salkeld
d48ed76dfd TEST: fix the map load test.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-23 13:36:07 +11:00
Angus Salkeld
7f09ba15d5 TEST: add a simple test for right-aligned text in format strings
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-18 10:13:00 +11:00
Angus Salkeld
dc3a061e98 MAP: pass user_data to the callback correctly
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-16 13:31:31 +10:00
Angus Salkeld
d6e352fda5 MAP: add a more generic notification system
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-15 21:14:49 +10:00
Angus Salkeld
4780308fea MAP: add prefix iteration for the trie
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 20:54:39 +10:00
Angus Salkeld
8ae2cf4430 TESTS: improve the map tests
- add a iterator to test_map_simple()
- improve the test output

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 17:08:19 +10:00
Angus Salkeld
57212c0e94 MAP: add a trie implementation
http://en.wikipedia.org/wiki/Trie

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-12 23:01:15 +10:00
Angus Salkeld
5944229b60 LOG: allow large priorities
They will be printed as trace, it's mainly to make
filtering more flexible

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-09 16:20:54 +10:00
Angus Salkeld
0a1c464514 LOG: add qb_log_filter_ctl2() so we can filter a range of priorities
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-09 14:09:02 +10:00
Angus Salkeld
f5fcf2a30b LOG: add a way of getting the target state
This is so we can do the following:

for (t = 0; t < QB_LOG_TARGET_MAX; t++) {
    if (qb_log_ctl(t, QB_LOG_CONF_STATE_GET, 0) == QB_LOG_STATE_ENABLED) {
        // bla bla
    }
}

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-08 16:40:02 +10:00
Angus Salkeld
be8248bd50 LOG: support comma seperated lists of file and function filters
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-08 13:24:18 +10:00
Angus Salkeld
86f004d1ec map: add iterator that does't use a callback
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-07 12:05:15 +10:00
Angus Salkeld
4b594b522d MAP: change the keys from void* to char*
I think this is the most common usage and greatly
simplifies the api.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-07 09:47:49 +10:00
Angus Salkeld
8c98054bfa Fix "./check dist"
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-26 09:37:25 +10:00
Angus Salkeld
94767b18b8 Initial map using either a skiplist or a hashtable
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 14:11:43 +10:00
Angus Salkeld
8f954cd115 Add a stop watch
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 13:28:15 +10:00
Angus Salkeld
1591075873 LOG: serialize the va_list, don't snprintf
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 10:29:48 +10:00
Angus Salkeld
96f5fad67b TEST: add int arguments to log bench
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-19 12:04:50 +10:00
The Quarterback Library Release Team
e910830b26 Make sure write_logs.c is deleted by "make distclean"
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2011-07-18 10:06:52 +10:00
Angus Salkeld
f4e2705e95 LOG: use strerror_r instead of strerror in qb_perror()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-27 15:57:51 +10:00
Angus Salkeld
dc278798a3 TEST: bump up the logging timeout
This was failing on sparcv9, but seems to just be a slow machine.
With a bigger timeout it passes.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-27 09:34:07 +10:00
Angus Salkeld
77b6e15a85 Consistently prepend "qb-" to files in /dev/shm
Dietmar: can you confirm this works for you?

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-20 16:36:26 +10:00
Angus Salkeld
86e5071287 TEST: Fix ssize_t format compiler warning
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-02 11:40:54 +10:00
Angus Salkeld
5b5a6c65d4 Make building a bit quieter by default.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-02 11:40:50 +10:00
Angus Salkeld
d8344f1bc2 Fix "make dist".
The deps were not quite right with write_logs.c

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-02 11:40:44 +10:00
Angus Salkeld
93f84c9c65 TEST: remove failed server tests.
They now fail (because of 8880465924).

We now need a smart way of detecting that a process is the
last one attached to the ringbuffer and free it.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-31 19:21:52 +10:00
Angus Salkeld
d4275c824a TEST: initialize some globals before the test is run.
This is not strictly needed as each test is forked,
but is a bit more explicit.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-31 19:12:39 +10:00
Angus Salkeld
af10eb4753 TEST: fix the server shutdown.
The server was getting prematurently killed, and was
causing resource leakage. We now give the server a little
time to respond to the connection beiong closed.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-31 19:10:51 +10:00
Angus Salkeld
c61beafa1e TEST: add job_add poll_handler
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-31 19:07:31 +10:00
Angus Salkeld
4f1d3d88d8 TEST: name the ipc connections after the test functions
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-31 19:06:44 +10:00
Angus Salkeld
a16322dd34 TEST: make the creation of write_logs.c atomic
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-27 10:15:02 +10:00
Angus Salkeld
0c0babd6d1 TEST: make sure make-log-test appends a bracket
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-26 21:34:19 +10:00
Angus Salkeld
da5ea1345e Remove all the C++ comments
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-26 10:39:36 +10:00
Jim Meyering
ab222595be adjust .gitignore so "git status" ignores all build artifacts
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-24 09:44:56 +10:00
Angus Salkeld
048edde19c LOG: add custom targets
This is partly to make the tests more robusts and
to add some more flexibility to the logging.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-23 20:28:18 +10:00
Angus Salkeld
8b5bb1d31d COV 12: prevent unintialized value error in bmcpt
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:37:13 +10:00
Angus Salkeld
9724860b9a COV 7: close file if for some strange reason it exists
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:31:29 +10:00
Angus Salkeld
e178c03db8 COV 3: remove dead code.
qb_rb_close() is called in the signal handler.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 16:49:59 +10:00
Angus Salkeld
e990681826 Fix the test dependancies (and "make rpm")
My first attempt at this broke "make rpm" - oops.
It seems that we need a common extension for tests to get the
dependancies to work.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-18 11:11:14 +10:00
Angus Salkeld
10942162a0 make sure check_resources is the last test to run
http://www.gnu.org/s/hello/manual/automake/Simple-Tests-using-parallel_002dtests.html

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-17 21:32:29 +10:00
Angus Salkeld
bfd627f576 Fix some compiler warnings
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-06 10:54:43 +10:00
Angus Salkeld
2a83aa8dfe LOG: add an enter and leave trace function
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-06 10:54:20 +10:00
Angus Salkeld
a050b13414 TESTS: add a threaded logging test
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-18 22:55:26 +10:00
Angus Salkeld
d8b1c2564c Compile on FreeBSD
Also re-run autoscan.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-15 14:01:36 +10:00
Angus Salkeld
a807d3b745 Add write_logs.c to .gitignore
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 22:24:38 +10:00
Angus Salkeld
17bdc93f88 LOG: fix the building of write_logs.c (for bench-log)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 16:58:29 +10:00
Angus Salkeld
45fa3b045d TESTS: use new logging API
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 16:05:46 +10:00
Angus Salkeld
c2f72d4068 LOG: add some basic tests & fixes
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 16:05:46 +10:00
Angus Salkeld
b7e83fd3b2 LOG: add dynamic callsites (for platforms that don't support __attribute__(section)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 16:05:38 +10:00
Angus Salkeld
0d345d3ef1 ARRAY: return -ERANGE when index is out of range.
So you can differentiate the other errors (-EINVAL)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-13 11:23:00 +10:00
Angus Salkeld
6d6872f187 Fix the copyright in bench-log.c
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-09 23:41:30 +10:00
Angus Salkeld
1844a839a6 LOG: only set state in log.c
This requires an enable after qb_log_file_open()

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-09 23:11:43 +10:00
Angus Salkeld
b5d27ad250 LOG: remove the tags arument from qb_log() and add qb_logt() which has the tags argument.
I think in most cases tags will not be used and it will
just be a pain inserting ", 0". But if someone wants to use
tags like this then they still can via qb_logt()

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:27:41 +10:00
Angus Salkeld
7f0d983f49 LOG: add a qb_log_fini() to cleanup
This replaces qb_log_thread_stop() but also release shared mem

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-01 14:50:51 +11:00
Angus Salkeld
e390613036 LOG: fix mapping from priority to name
Remove qb_log_priority_name_get() as we have the
formatting.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:38:08 +11:00
Angus Salkeld
191b71a8b7 LOG: add a new "tags" field
this is a tags that is used by the caller to:
- define the message as an external message (needs free'ing)
- define a feature or susbsytem that can be printed in the log message.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:37:44 +11:00
Angus Salkeld
5ed2ca8592 LOG: add bench-log to .gitignore
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:24:40 +11:00
Steven Dake
0729a8e80b Add a benchmark program for the qblog flight recorder
Signed-off-by: Steven Dake <sdake@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:22:57 +11:00
Angus Salkeld
34ee74db55 LOG: add a format option to each target.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 23:06:41 +11:00
Angus Salkeld
32817adb15 LOG: re-work the API to be easier to use.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 11:46:36 +11:00
Angus Salkeld
3452d162d2 LOG: add a qb_perror() function
- Add an internal version too
- Update the library code to use it.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-28 11:12:47 +11:00
Angus Salkeld
2956f9ef29 LOG: add a timestamp to the log handler
This makes sure that the timestamp is correct at the time
the call to qb_log() was called.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-27 22:57:58 +11:00
Angus Salkeld
60e9ffe75e TESTS: remove unused function
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-27 22:03:57 +11:00
Angus Salkeld
6eddcfc26e LOG: split the tag function out into tag and untag
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-27 22:03:33 +11:00
Angus Salkeld
f86c96bee1 LOG: add a blackbox
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-25 23:40:53 +11:00
Angus Salkeld
5bddb0fe68 LOG: add threaded logging (non-blocking)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-25 23:35:35 +11:00
Angus Salkeld
e910f8bc18 Add logging infrastructure.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-25 23:34:12 +11:00
Angus Salkeld
7cd7dc106c TESTS: make sure timers are not leaking file descriptors
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-22 09:12:57 +11:00
Angus Salkeld
7d46c9ad3f IPC: use rb refcount to check for "connectiveness"
This makes it possible the detect the loss of the server
and return -ENOTCONN.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-16 22:09:52 +11:00
Angus Salkeld
a2b2ed7988 TEST: add ipc tests for recv's with a timeout
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-16 22:09:52 +11:00
Angus Salkeld
43181d5a95 IPC: add a timeout to the client recv functions
Also allow the ringbuffer to pass ETIMEDOUT back to the
client applications.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-16 21:47:47 +11:00
Angus Salkeld
45ff679934 LOOP: change timers to be nano second based
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-13 12:23:45 +11:00
Angus Salkeld
d0b14bdbdf IPC: return -ENOTCONN when the other end exits
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-10 12:22:03 +11:00
Angus Salkeld
a97c278833 TESTS: add a test case for recving from a failed server
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-10 11:12:55 +11:00
Angus Salkeld
1a073f7b29 LOOP: prevent timers from deleting them selves.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-15 16:03:31 +11:00
Angus Salkeld
f7f6c89591 TLIST: use qb_util_nano_monotonic_hz() instead of HZ
also add a test for under running.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-12 15:15:31 +11:00
Angus Salkeld
e7d2dd9646 LOOP: add signal support to main loop
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-09 11:51:22 +11:00
Angus Salkeld
c516965fbb IPC: add connection_closed() callback.
- added another callback closed() and use this as the current
  destroyed_connection() has been used.
- the destroyed() event changes meaning to
  "the connection object is about to be free'ed"
  and the user can free the context memory.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-04 10:16:58 +11:00
Angus Salkeld
b07b65df42 IPC: change service instance from handle to pointer.
Mainly to be consistent with the other objects.

Also:
- splint warnings(-weak) are now zero.
- Added a reference counter to replace the handle.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-03 21:41:05 +11:00
Angus Salkeld
6714a170a5 Fix ./check_all
- Spelling error in "make distcheck"
- add check_resources.sh to EXTRA_DIST

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-03 21:39:14 +11:00
Angus Salkeld
720adbdddf IPC: add flow control & q_len to unix socket transport.
This uses a small (2*int32_t) shared memory segment.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-03 09:48:15 +11:00
Angus Salkeld
0207003da5 RB: don't be so timid on shutdown
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-02 23:19:26 +11:00
Angus Salkeld
951451018d TEST: add a check_resources script
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-02 23:17:39 +11:00
Angus Salkeld
920a927116 Cleanup config defines & add a check_all script
Run:
./check_all
to build with and without some common configurations.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-01 22:05:46 +11:00
Angus Salkeld
dc08661297 LOOP: add support for timerfd
If available use timerfd_create() as it is
much more accurate than tlist.h

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-01 10:14:08 +11:00
Angus Salkeld
27d7df8edf TEST: make test ouput more verbose
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-30 20:52:12 +11:00
Angus Salkeld
970a4bc6d5 LOOP: add qb_loop_destroy()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-30 20:51:36 +11:00
Angus Salkeld
e211caab96 LOOP: fix job poll and simplify main loop
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-29 22:26:46 +11:00
Angus Salkeld
e390a373d5 IPC: add server connection states for better shutdown.
This also fixes the refcounting, which was not quite right.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-27 11:48:56 +11:00
Angus Salkeld
36d1171e2a IPC: add job_add() API to the poll abstraction.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-27 11:33:00 +11:00
Angus Salkeld
c5ed1450a1 IPC: add stats to server end.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-21 21:43:26 +11:00
Angus Salkeld
ca8fd021f3 TEST: add glib mainloop option to bms
Note: glib is only linked into the test app, so
libqb not dependant on glib. This is just testing
integration.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-20 11:31:44 +11:00
Angus Salkeld
7b2a0d3767 TEST: add some more array tests.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 21:16:47 +11:00
Angus Salkeld
f621d9f3a0 Fix the current warnings
Add missing qbutil.h

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 11:04:25 +11:00
Angus Salkeld
37fc16d4f2 IPC: get bmcpt working
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:55 +11:00
Angus Salkeld
9745d4feb7 Add a resizable array that doesn't move memory.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:54 +11:00
Angus Salkeld
31ca215188 IPC: add support for unix sockets
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-17 14:23:53 +11:00
Angus Salkeld
8585b958cc TEST: add support events into bm[cs]
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-16 22:01:51 +11:00
Angus Salkeld
e9d10dfdbe IPC: remove flow control API and move functionality into send()
There is no point in a separate API.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-14 09:16:00 +11:00
Angus Salkeld
93d8bcabfb TEST: make the bmc messages like cpgbench
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-13 08:23:14 +11:00
Angus Salkeld
45c41935b7 RB: return EAGAIN not ENOMEM if no space on the rb.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:53 +11:00
Angus Salkeld
e1686dbd6a IPC: add support for flowcontrol & rate limiting
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:53 +11:00
Angus Salkeld
8d3ec80c19 RB: add support for shared user data.
(I need this for flow control)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:53 +11:00
Angus Salkeld
8df21458f5 IPC: get the poll independent functions working.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
1f6c42b098 IPC: make msg_process return type int
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
08e5a9004d Add a priority based main loop.
This is to try and get a better balance in the amount
of processing between IPC and totem in corosync.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
3dcd1126f6 IPC: remove qb_ipcc_event_release()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:46:53 +11:00
Angus Salkeld
f1f301724b IPC: improve resource cleanup/shutdown
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
f93051a758 TEST: disable posix mq test for now.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
69f2c88081 IPC: add a service_id and merge qb_ipcs_create() + qb_ipcs_service_handlers_set()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-02 21:06:12 +10:00
Angus Salkeld
fcd0ca69d9 IPC: change the ipcs_connection to a pointer (not handle).
This is make integrating with corosync easier.
Also technically it doesn't really matter it still
has a reference counter.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-01 22:57:02 +10:00
Angus Salkeld
2aae94eb1d IPC: make authenticate callback more generic "accept".
This is so that it is more obvious that you can use
it for authentication, service availabilty and
process resource constraints.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-01 22:57:02 +10:00
Angus Salkeld
4e28b94e83 TEST: fix ipc test after receint API changes.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-30 20:49:40 +10:00
Angus Salkeld
e3a6cd6ad6 Delete unchecked API (to be re-added later).
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-30 20:49:11 +10:00
Angus Salkeld
86c84f6ae0 IPC: new auth improvement and limits work around.
Create the queues/ringbuffers on the server so we don't
have to modify proc entries. Then chown them so that
the clients can access them.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-30 20:17:59 +10:00
Angus Salkeld
9556038195 IPC_SYSV: get sysv ipc to work with non-root processes.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-29 14:35:59 +10:00
Angus Salkeld
7a5cc45077 TEST: add IPC_TYPE cli option to bms
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-29 14:34:51 +10:00
Angus Salkeld
00a69d1c09 TEST: make bmc's output comma delimited
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-29 14:32:51 +10:00
Angus Salkeld
b6d4fb95b8 IPC: add events back (were dispatch messages in corosync)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-29 14:32:51 +10:00
Angus Salkeld
b29a1809f4 IPC: rename qb_ipcs_connection_pt -> qb_ipcs_connection_handle_t
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-29 14:32:51 +10:00
Angus Salkeld
b28173ee81 IPC: get shm & pmq working
Note: pmq needs "sudo make check"

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-07 14:11:42 +10:00
Angus Salkeld
e7de13cd9d IPC: add a basic tx/rx test case.
- cleanup some printf's

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-07 08:56:38 +10:00
Angus Salkeld
d27e50c58a Define new return status policy
Good >= 0 (0 = good, or positive value)
Bad < 0 (-errno)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-06 16:49:15 +10:00
Angus Salkeld
e5ffd5a210 BSD: port new changes to BSD
- check for doxygen
- no RLIMIT_MSGQUEUE on bsd
- change ENODATA to ENOMSG

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-03 14:04:00 +10:00
Angus Salkeld
8a6b8d78db IPC: rewrite (simpler API & more structured layout).
- implement using posix message queues
- implement using sys-v message queues
- implement shared memory ringbuffers
- add auth via unix sockets
- add items to the TODO

This is still a bit rough, more work to follow...

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-08-23 12:46:36 +10:00
Angus Salkeld
a6285e6f14 RB: add function qb_rb_chunks_used()
This is to make it easier to to see if there is
a chunk available to be read.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-08-09 16:59:26 +10:00
Angus Salkeld
41c06ef6e6 int -> int32_t
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-22 11:55:09 +10:00
Angus Salkeld
60b11eee49 unsigned int -> uint32_t
some to int32_t (bugs)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-22 11:54:58 +10:00
Angus Salkeld
b8a5a74fcc hdb: move functions into cfile
convert int -> int32_t
rename qb_hdb_handle_t -> qb_handle_t
rename DECLARE_HDB_DATABASE -> QB_HDB_DECLARE
rename qb_hdb_handle_database -> qb_hdb

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-16 09:12:20 +10:00
Angus Salkeld
7deaa935c7 ipc: use a ringbuffer for requests.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-15 12:56:33 +10:00
Angus Salkeld
ec9a050a29 rb: make rb_chunk_peek() wait on the sem like chunk_read()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-15 12:56:23 +10:00
Angus Salkeld
55285984e7 bm test programs: allow no args
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-12 11:26:20 +10:00
Angus Salkeld
80cca9b6ab check_hash: test for dict/words before running.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-12 09:09:25 +10:00
Angus Salkeld
7a90cdda1f Remove unneccessary extern's.
http://gcc.gnu.org/ml/gcc/2009-04/msg00812.html
http://publications.gbdirect.co.uk/c_book/chapter4/linkage.html
http://www.eskimo.com/~scs/cclass/notes/sx5b.html

note in ipcs.c qb_ipcs_ipc_init() is extern'ed, I don't
think that this is needed - we'll soon see :)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-11 08:29:31 +10:00
Angus Salkeld
0a23eb2be1 Format all files with Lindent
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-10 21:42:08 +10:00
Angus Salkeld
bd2c07f739 Add a ringbuffer based off the one in logsys.
This ringbuffer is usable across processes.
the point is to use this for IPC to provide async
connections from client to server, but with inherient
flow control.

This still needs a bit of clean up, but committing now
for feedback and as it is quite functional.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-10 12:44:27 +10:00
Angus Salkeld
d925eb8630 Comment out the plugin tests as they break "make rpm"
I can't figure out a "nice" way of doing this.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-31 10:39:28 +10:00
Angus Salkeld
7cfb5e472f Roll all little libs into libqb.
This really makes things simpler (to produce and use).

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-27 11:34:58 +10:00
Angus Salkeld
29cee5ec5e use new interanl logging functions
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-25 15:53:44 +10:00