Angus Salkeld
2b2dfd5d2c
RB: use the proper struct not the typedef in the implementation.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:50 +11:00
Angus Salkeld
dff3ff4afe
RB: Fix potential mem leak
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:50 +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
943e6b301d
Remove dead code
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:49 +11:00
Angus Salkeld
58c4a80027
set umask before calling mkstemp()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:49 +11:00
Angus Salkeld
7a6382f0b6
Use safer versions of string functions (strcpy -> strlcpy)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:49 +11:00
The Quarterback Library Release Team
362b0dccd4
Bump the lib version to 0.10.0
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-07 20:30:48 +11:00
Angus Salkeld
346e4d892a
LOOP: handle errors from the poll function
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-07 10:16:00 +11:00
Angus Salkeld
b602680e1d
LOOP: make the item type applicable to jobs too.
...
Mainly for diagnostics
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-07 10:07:17 +11:00
Angus Salkeld
48e7cff259
LOOP: fix the todo calculations.
...
The todo system was sucky as it was calculated in different
places in the mainloop and at each level. This was exposed by
calls to qb_loop_level_item_del() which decremented the level->todo
but not the mainloop one. So now we re-calculate it each time.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-07 09:41:00 +11:00
Angus Salkeld
f869f93deb
LOOP: prevent jobs from consuming too much cpu.
...
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
ad4efc2005
LOG: pass the result of qb_log_thread_start() back to the user
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-03 14:37:37 +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
Angus Salkeld
86428907c7
IPC: merge common code into new function
...
This also fixes a regression caused by:
42c92fb675
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-31 11:34:50 +11:00
Angus Salkeld
7d9df9ef74
IPC: better handle a disconnect been called from within connection_created()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-31 11:34:00 +11:00
Angus Salkeld
55e4c3048a
IPC: fix scary typo
...
Not sure how this happened
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-27 22:28:44 +11:00
Angus Salkeld
42c92fb675
IPC: fix server error handling
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-27 22:27:08 +11:00
The Quarterback Library Release Team
e2bb6d7277
Bump the library version to 0.9.0
2012-01-26 21:52:03 +11:00
Angus Salkeld
e78820b243
PTRIE: refcount the notifier structs
...
This fixes: https://github.com/asalkeld/libqb/issues/29
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-25 16:09:32 +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
36e77bb99d
LOG: only bump messages that need it (>info)
...
else all the messages get their priorities distorted
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-23 16:47:30 +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
18bcbef790
IPC: this 1 sec wait is slowing all normal dissconnects down
...
this works just as well with a timeout of 0
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-23 10:39:31 +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
2f99276d16
IPC: add a context to the client interface
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-18 15:24:34 +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
db29539544
make the pc file auto detect -lrt
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-16 22:33:21 +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
7eaa3dc09a
LOG: add %P (pid) as a format option.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-09 16:03:15 +11:00
Angus Salkeld
b711f73ce7
LOG: add %N (log name) as a format option
...
This will log the name passed into qb_log_init()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-09 16:02:53 +11:00
Angus Salkeld
ef64fd1186
UTIL: fix qb_timespec_add_ms()
...
It was overwriting the timespec value instead of
add to it.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-09 10:24:08 +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
The Quarterback Library Release Team
e0d55fe8f7
Bump the library version.
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-01-05 17:46:38 +11:00
Angus Salkeld
e15a48254a
ipc: make coverity happy.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-05 16:46:59 +11:00
Angus Salkeld
f7a08eae5c
trie: correct the free'ing of node mem
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-05 16:12:19 +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
Angus Salkeld
5d8c96314e
Allow the array to automatically grow.
...
this makes it a bit friendlier to use, as
the user will not have to call qb_array_grow().
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-04 21:40:03 +11:00
Angus Salkeld
fa70ec98e8
IPC: remove fd from poll loop in the disconnect
...
Until now we have been relying on getting a POLLHUP, but
under heavy load we seem to get an old poll event
that cause a double deref of the connection object.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-03 13:49:18 +11:00
Angus Salkeld
c3eb1be7ed
IPC: add a new state to the connection state
...
This to handle disconnecting in a failure state (before
the connection has been established.
Another aspect to this is we don't want to call
connection_destroyed() if we haven't called
connection_created().
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-03 13:49:15 +11:00
Yunkai Zhang
c8e97a1c2e
Fixed bug: incorrect array length definition
...
When MAX_BINS is larger than MAX_BIN_ELEMENTS, this bug will cause
boudary overflow in qb_array_create function.
Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-29 10:12:07 +11:00
Fabio M. Di Nitto
d823a480dc
Fix a compile warning on sparc (epoll_create1)
...
The problem is that sys/epoll.h was broken on sparc and alpha for a
bunch of glibc releases.
glibc has the symbol correctly exported, that's why ./configure finds
it, but the header is not always correct. Recent versions of glibc have
the correct header, so we simply workaround the broken ones.
This fix is only necessary to build with --enable-fatal-warnings,
otherwise you simply see a build warning, but there are no runtime
issues at any stage.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-22 22:55:27 +11:00
Angus Salkeld
ca534c4df8
re-fix qb_strerror_r() in case caller frees buf.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-22 14:03:18 +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
Andrew Beekhof
61d166abbc
Support compilation on Mac OSX
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-19 22:16:30 +11:00
Angus Salkeld
e6f008cc09
fix strerror on non-linux
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-19 22:12:08 +11:00
Angus Salkeld
f0a6ef28ac
trie: don't create children array on all nodes
...
(save mem on leaf nodes)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-18 22:52:29 +11:00