Commit Graph

542 Commits

Author SHA1 Message Date
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
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
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
Angus Salkeld
5ff07bf9de Increase the coverity aggressiveness
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
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
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
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
0710b40cde Change example code to use fgets instead of gets
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-03 14:37:37 +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
3e3eb4e007 Add clang-analyzer check
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
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
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
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
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
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
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
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
2d3d3eaae0 Make all headers self standing
So the user does not have to include any required headers.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-16 22:21:03 +11:00
Angus Salkeld
b5b9763459 make header protection more consistent.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-16 22:19:38 +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
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