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
Angus Salkeld
3bfa04dbd7
trie: convert the trie to a patricia trie (or radix tree)
...
http://en.wikipedia.org/wiki/Radix_tree
The point of this is to save memory.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-18 22:52:29 +11:00
Angus Salkeld
9efc82f4b2
trie: add a way to get node count and mem usage
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-18 22:52:29 +11:00
Angus Salkeld
6e54ae53d4
trie: split trie_lookup into trie_lookup and trie_insert
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-18 22:52:29 +11:00
Angus Salkeld
e0c5187023
IPC: provide finer grained flowcontrol
...
this will allow the user to control the behaviour better.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-14 00:55:06 +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
2d92af61c5
map: add qb_map_notify_del_2() which includes the userdata.
...
This allows you to match on the same fields that you provided
in the add. Now including the userdata.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 11:28:14 +11:00
Angus Salkeld
3c01f7bdb2
skiplist: add the inserted notification
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 11:28:01 +11:00
Angus Salkeld
fbdfd34f59
skiplist: implement skiplist_notify_del()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 11:19:11 +11:00
Angus Salkeld
52321a8185
Hashtable: fix the ordering of the new/old value in the notification
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 11:15:40 +11:00
The Quarterback Library Release Team
ce18956cc2
Bump the library version to 0.7.0
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2011-11-16 21:42:33 +11:00
Angus Salkeld
ee50e90fc2
LOOP: free up the signal list when qb_loop_destory() is called
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-10 21:30:37 +11:00
Angus Salkeld
177e54cb14
LOG: improve the removal of filters
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-10 21:29:04 +11:00
Angus Salkeld
fdf418abf5
LOG: clean up mem better when qb_log_fini is called
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-10 21:28:14 +11:00
Angus Salkeld
b2a0c06d50
ARRAY: make sure that num_bins stays below MAX_BINS
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-10 09:28:55 +11:00
Angus Salkeld
ca4fe98136
Lindent formatting changes.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:49:14 +11:00
Angus Salkeld
99311d24fe
LOOP: close opened pipe if function fails
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:43:21 +11:00
Angus Salkeld
b519f4f37d
LOG: change assert into an early return
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:42:26 +11:00
Angus Salkeld
0171399274
Remove unnecessary checks before free()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:41:32 +11:00
Angus Salkeld
9959615598
MAP: Fix trie_new_node() and make skiplist_node_new() more consistent.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:39:13 +11:00
miz-take
fcd96fc8e0
Improve the error handling esp. after failed malloc's
...
Reviewed-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 09:50:38 +11:00
Angus Salkeld
a44df811a0
skiplist: destroy the list header last.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-24 09:35:13 +11:00
Angus Salkeld
ba95aafbf7
LOG: check for SCHED_IDLE
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-23 13:36:07 +11:00
Angus Salkeld
596bcf3dde
LOG: fix filter input check
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-23 13:36:07 +11:00
Angus Salkeld
ae86140250
LOG: only range check "t" when filtering else tags are not applied.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-21 14:51:22 +11:00
Angus Salkeld
bca6380eba
Log: move the lock to below the sem_wait
...
(coverity ordering warning)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-18 14:02:29 +11:00
Andrew Beekhof
68b33d7243
Log: Support right-aligned text in format strings
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-18 09:51:19 +11:00
Yunkai Zhang
8a673559e7
Fixed segment fault bug when use logging API at i386 platform
...
This bug cause by qb_vsprintf_serialize function. It parse "%llx" format
as _long_ other than _long long_.
At x86_64 platform, both sizeof(long) and sizeof(long long) is 8, this
issue would not be triggered, so we could only catch it at i386.
Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-18 09:33:24 +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
6c260080ed
hashtable: fix the iterator
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 17:09:20 +10:00
Angus Salkeld
34e5a469aa
skiplist: fix order of deref
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 17:09:20 +10:00
Angus Salkeld
94df31cb44
skiplist: use ++ and -- operators
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 17:09:20 +10:00
Angus Salkeld
61268e3cb9
MAP: improve the storage in the trie
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 17:09:20 +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
The Quarterback Library Release Team
c8309edf72
Bump the library version.
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2011-09-09 12:54:03 +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
0a50fe57e7
LOG: add facility conversion functions
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-07 09:47:49 +10:00
Angus Salkeld
9df0c32398
LOG: fix the default syslog filter
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-01 13:51:06 +10:00
Angus Salkeld
2b7edd508d
defs: better define va_copy
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-26 09:39:26 +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
564d3281ef
hashtable: Fix a lint warning
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-25 22:22:09 +10:00
Angus Salkeld
e1be00130c
LOG: fix ansi build
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 14:11:43 +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
523922b202
LOG: change active list into array access
...
just keep track of the max used targets
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-19 12:44:37 +10:00
Angus Salkeld
ea8dfea7a0
LOG: allow the thread priority to be set.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-07 22:37:42 +10:00
Angus Salkeld
453dd31431
Fix splint warning on ubuntu 11.04
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-07-19 14:08:57 +10:00
Angus Salkeld
c41113aaec
LOG: move priority check up to prevent unnecessary format.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-07-14 12:38:02 +10:00
Angus Salkeld
bb1140fbd9
Add a qb_strerror_r wrapper.
...
This is to make the calling code more portable
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-07-14 10:41:46 +10:00
Angus Salkeld
0cb84fcda2
configure: improve arch & os detection output.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-26 23:29:19 +10:00
Angus Salkeld
b8fbeb3d4b
LOG: fix alignment compiler warning on sparc
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-26 23:23:42 +10:00
Angus Salkeld
478e00b2c0
Revert "LOG: use uint8_t for pointer manipulation"
...
This reverts commit a47ae0b659
.
2011-06-26 19:08:15 +10:00
Jim Meyering
876dc70ce2
don't let an invalid time stamp provoke a NULL dereference
...
* lib/log_blackbox.c (qb_log_blackbox_print_from_file): Handle
localtime failure by printing the long-int representation rather
than a strftime-formatted one.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-26 18:58:56 +10:00
Angus Salkeld
98493d9ae8
Change Lindent options to break the procedure type.
...
so change:
int foo(void)
to
int
foo(void)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-22 14:19:14 +10:00
Angus Salkeld
001b4a078c
LOOP: make the return more consistent in qb_loop_timer_expire_time_get()
...
If there is any error return 0
(meaning the timer is or has expired)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-22 13:13:34 +10:00
Angus Salkeld
a47ae0b659
LOG: use uint8_t for pointer manipulation
...
char changes size on different arches.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-21 09:02:35 +10:00
Angus Salkeld
42e79dfd2f
IPC: use the correct pointer type.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-20 16:36:34 +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
The Quarterback Library Release Team
a69482ade6
Update the library version to 0.5.0
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2011-06-07 21:11:58 +10:00
Angus Salkeld
4a3536e72c
Re-fix mmap() woes on sparc.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-07 19:53:26 +10:00
Angus Salkeld
34e9820230
Revert "Fix ringbuffer creation on sparc"
...
This reverts commit 683296f180
.
2011-06-03 22:43:09 +10:00
Angus Salkeld
683296f180
Fix ringbuffer creation on sparc
...
On the first call to qb_rb_open() we try using a number of
page sizes. This because the system might have CONFIG_HUGETLB_PAGE_SIZE
defined in their kernel. So even though sysconf() returns 2K or 4K
some arch's mmap() require alignment on these boundaries.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-02 11:42:14 +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
9666c392cb
Fix some spelling.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-02 11:40:39 +10:00
Angus Salkeld
da150fcb22
IPC: misc cleanup & logging improvements
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-31 19:03:50 +10:00
Angus Salkeld
016b713489
IPC: make the setting the flowcontrol atomic
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-31 19:01:46 +10:00
Виноградов Василий
8880465924
RB: More consistent behavior when closing a ringbuffer
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-30 21:16:35 +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
d8a7fffd4d
qb_rb_write_to_file clean-up
...
* lib/ringbuffer.c (qb_rb_write_to_file): Remove dead initialization
and redundant "result < 0" tests.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-24 09:45:17 +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
ec15ca46f6
COV 15: fix potential reference after deref
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:37:13 +10:00
Angus Salkeld
2a1e9618d7
COV 14: fix potential dereference after free()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:37:13 +10:00
Angus Salkeld
9f11955e94
COV 13: cleanup error handling in qb_util_circular_mmap()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:37:13 +10:00
Angus Salkeld
6acc19bdc3
COV 10: fix mem leaks in qb_rb_create_from_file()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:31:29 +10:00
Angus Salkeld
8b5d664876
COV 9: fix mem leak in qb_rb_open error condition
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:31:29 +10:00
Angus Salkeld
24107d56ef
COV 8: don't leak mem when returning an error.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:31:29 +10:00
Angus Salkeld
f5d85f7e61
COV 6: check for a failed sysconf() before calling malloc()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:31:29 +10:00
Angus Salkeld
a5a1085bca
COV 4 & 11: cleanup error handling in handle_new_connection()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:30:49 +10:00
Angus Salkeld
ac929fc7cd
COV 2: fix unreachable code (move call to qb_ipcs_us_withdraw up)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 13:45:21 +10:00
Angus Salkeld
4062a2bba6
COV 1: dead code - clean up ifdefs
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 13:41:52 +10:00
Angus Salkeld
0cdf5b4ad8
LOG: add a rwlock to protect the lists.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-19 13:58:11 +10:00
Angus Salkeld
7a2b77f575
IPC: set the return status before cleaning up.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-18 11:49:51 +10:00
Angus Salkeld
943b1c646b
fix the FIXME's Jim pointed out
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-18 11:11:14 +10:00
Jim Meyering
9c467cb150
add FIXME comments for other NULL-deref-upon-OOM problems
...
* lib/ipc_us.c (handle_new_connection):
* lib/loop_job.c (qb_loop_jobs_create):
* lib/loop_poll.c (qb_loop_poll_create):
* lib/loop_timerlist.c (qb_loop_timer_create):
* lib/ringbuffer.c (qb_rb_open):
* lib/ipcc.c (qb_ipcc_connect): Likewise.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-17 21:32:29 +10:00
Jim Meyering
4020c4cea8
avoid NULL dereference after failed malloc
...
* lib/util.c (qb_thread_lock_create): Handle failed malloc.
* lib/ipc_posix_mq.c (qb_ipc_pmq_sendv): Likewise.
* lib/loop_job.c (qb_loop_job_add): Likewise.
* lib/loop.c (qb_loop_create): Likewise.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-17 21:32:29 +10:00
Angus Salkeld
373709e082
LOG: strip the last "\n" from incomming messages
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-13 10:06:45 +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
06642a4227
LOG: add locking & change dcs list into a singly-linked list.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-18 22:57:23 +10:00
Angus Salkeld
a8eef8a9d6
LOG: check prioritynames[] bounds
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-18 22:54:13 +10:00
Angus Salkeld
2561b8fb96
LOG: created array with wrong size - yikes!
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-18 22:54:13 +10:00
Angus Salkeld
6f73dd2993
LOG: make all priorities uint8_t
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-18 22:54:13 +10:00
Angus Salkeld
88107c1bd7
LOG: fix logging to file
...
qb_log_file_open() left the target in an UNUSED state.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-15 15:11:24 +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
7d89455bec
LOG: refactor the filter code a bit.
...
Reuse code a bit better.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 22:23:51 +10:00
Angus Salkeld
c92feeb694
LOG: fix new callsite pointer (not incrementing correctly)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 22:22:22 +10:00
Angus Salkeld
5af627b40f
LOG: fix formatting test (fails in make distcheck)
...
This fails as the BUILDING_IN_PLACE patch was left out.
Now re-added, make distcheck passes.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 16:31:07 +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
4de5ff927f
ARRAY: add getter's to retrieve number of bins and elms/bin
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 09:55:57 +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
568befd3f1
LOG: add LOG_TRACE
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-12 22:21:57 +10:00
Angus Salkeld
78541f5198
LOG: add the ability to adjust the priority sent to syslog()
...
If you have:
qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD,
QB_LOG_FILTER_FILE, "hack.c", LOG_DEBUG);
these logs will not make there way to /var/log/messags
without reconfiguring syslog.
So to help on the fly debugging do the following:
qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_PRIORITY_BUMP,
LOG_INFO - LOG_DEBUG);
Now all messages that have the QB_LOG_SYSLOG target set
will have their priority bumped before going to syslog().
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-12 22:20:50 +10:00
Angus Salkeld
a7ef133736
LOG: flush output to files
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-09 23:33:53 +10:00
Angus Salkeld
58697dbcc6
LOG: change the target type from uint32_t to int32_t.
...
This is so that you won't get warnings from mixing integer types.
I have updated the input checks in log.c to check for invalid
targets.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-09 23:11:44 +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
bee9477d67
LOG: fix splint warning
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:43:49 +10:00
Angus Salkeld
249546a9e7
LOG: teach filter_ctl() to write tags
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:27:53 +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
479d2a3eda
LOG: change the filter matches to use strstr() for partial match support.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:22:21 +10:00
Angus Salkeld
9aa50b2ece
LOG: fix shared library callsites
...
This finds all the callsites in shared libraries
(using dl_iterate_phdr()) at the time qb_log_init()
is called.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Conflicts:
lib/log.c
2011-04-06 22:09:46 +10:00
Angus Salkeld
9b18614473
LOG: add a callsite_dump() function to see what callsite are avaliable.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:06:01 +10:00
Angus Salkeld
aefae42937
LOG: support dynamically loaded modules
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 21:41:13 +10:00
Angus Salkeld
57fee1b0e3
LOG: make prioritynames[] static
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 21:30:34 +10:00
Angus Salkeld
c97d98f7f7
LOG: general cleanup (indentation, NULL checks, etc...)
2011-04-01 15:32:44 +11:00
Angus Salkeld
631f56b8d6
LOG: move formatting code into new file
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-01 15:05:16 +11: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
9d159ab87f
LOG: change "tags" field to "targets"
...
This is it's new meaning, so makes things clearer
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:33:37 +11:00
Angus Salkeld
fe3a360279
LOG: keep a list of active targets to speed iteration
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:32:30 +11:00
Angus Salkeld
34c96d57e5
LOG: deal better with timestamps
...
1) use gettimeofday() - suprisingly faster than clock_gettime(MONOTONIC)
2) don't format the time until it is needed
3) insert time_t into the blackbox (not a formatted string)
This improves performance and tidies the code up.
It also requires less space in the blackbox.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:30:12 +11:00
Angus Salkeld
a66b7c8a86
LOG: fix minor compile warning
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:21:26 +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
da28f16dd8
LOG: add qb_log_file_close()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 21:22:27 +11:00
Angus Salkeld
2836e5bcf9
LOG: add the ability to import logs from other sources.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 21:17:50 +11:00
Angus Salkeld
6bf863abeb
Ignore 2 splint warnings
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 12:51:47 +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
dd4d21472c
LOG: add qb_log_priority_name_get()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-28 12:25:26 +11:00
Angus Salkeld
04b76a0f27
LOG: fix make install and distcheck
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-28 12:25:06 +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
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
a215e856d8
LOG: fix splint warnings
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-27 21:01:11 +11:00
Angus Salkeld
f2a26b5026
LOG: use the new logging mechanism for internal log messages.
...
This uses the top bit of the "tags" to distinguish
the internal messages from extternal ones.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-26 20:32:03 +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
34905e197c
LOG: create a common header
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-25 23:35:04 +11:00
Angus Salkeld
e910f8bc18
Add logging infrastructure.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-25 23:34:12 +11:00
The Quarterback Library Release Team
6e10c00344
Bump library version to 0.4.1
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2011-01-31 13:08:45 +11:00
Angus Salkeld
6b96fdcbf1
LOOP: check read() return value
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-01-09 17:23:45 +11:00
The Quarterback Library Release Team
f647c79693
Bump version to 0.4.0
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2011-01-05 21:56:53 +11:00
Angus Salkeld
8431910be0
LOOP: change timer handle from pointer to index + check.
...
This changes the timer hande from a live pointer to a handle
more like hdb handles (minus the ref counting).
What i like about this is it is not neccessary to clear
the applications handle using memset().
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-01-05 10:52:30 +11:00
Angus Salkeld
8d96ea05bc
LOOP: make static functions like _<name>_()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-22 09:12:56 +11:00
Angus Salkeld
8c28e4558a
LOOP: reduce the number of for loops
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-22 09:12:56 +11:00
Angus Salkeld
bba1f150d1
LOOP: change entry type enum
...
This to avoid QB_POLL been equal to 0, which could
hide some bugs.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-22 09:12:17 +11:00
Angus Salkeld
6c6486204b
LOOP: add per-level todo counters
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-22 09:12:04 +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
fa892f679c
RB: add a function to get the reference count.
...
Really handy to see if the peer is "connected".
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
62cef166b4
IPC: improve shm performance by timing out earlier on poll()
...
My receint change adding in a call to recv_ready(, 10) was
really slowing down the shm performance.
So now I am rather retrying which doesn't slow it down
and also passes "make check".
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-14 22:54:16 +11:00
Angus Salkeld
7f0e653794
IPC: return the correct number of bytes sent
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-14 21:51:08 +11:00
Angus Salkeld
859006bb14
IPC: rename _ref_inc() to _ref()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-13 16:18:19 +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
8e291c78d5
IPC: return EAGAIN from qb_ipcc_recv() if recv_ready() returns 0
...
found with corosync CTS
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-10 16:12:01 +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
89192dbc72
Remove carriage returns in qb_util_log() calls.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-10 09:46:48 +11:00
Angus Salkeld
2e81d71182
IPC: check for null ringbuffer
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-10 09:46:48 +11:00
Angus Salkeld
0300f3c9a5
IPC: fix non-blocking event mechanism
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-10 09:46:48 +11:00
Angus Salkeld
a80fde39ef
LOOP: remove unneccessary event array
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-10 09:46:47 +11:00
Angus Salkeld
5289646a7c
IPCS: don't block on sending socket notification
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-03 12:48:05 +11:00
Angus Salkeld
47cedda894
IPC: export qb_ipcs_disconnect()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-03 11:19:09 +11:00
Angus Salkeld
78de0712fb
fix waring produced by -Wp,-D_FORTIFY_SOURCE=2
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-17 10:48:41 +11:00
Angus Salkeld
5ad129874e
Fix some freeBSD compile warnings.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-16 21:46:49 +11:00
Angus Salkeld
d8a433b0b3
LOOP: fix compile warning when we don't have timerfd.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-16 20:58:49 +11:00
Angus Salkeld
668eb0a2d5
LOOP: move pipe creation into qb_loop_signals_create()
...
Also make sure the pipe is non blocking.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-16 14:38:34 +11:00
Angus Salkeld
3d7f619968
RB: fix munmap size (else shared mem not freed correctly)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-16 14:36:25 +11:00
Angus Salkeld
17c0cbda61
Fix some error handling in RB & IPC
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-16 14:36:25 +11:00
Angus Salkeld
a292be30c5
IPC: remove try again log message
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-15 16:03:37 +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
f7a28f1be2
LOOP: add some debug to log slow jobs
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-12 22:39:59 +11:00
Angus Salkeld
bc19fd32d8
IPC: withdraw server socket when destroying a service.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-12 22:13:43 +11:00
Angus Salkeld
a0f043f424
RB: check for NULL on close
...
this just saves the user from doing this.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-12 15:15:30 +11:00
Angus Salkeld
dd260826b5
UTIL: check for shm usable space.
...
- port corosync write() check
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-12 15:14:51 +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
fa57927089
LOOP: prevent high cpu utilization on no load.
...
We we passing "0" timeout into poll().
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-05 09:32:26 +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
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
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
fbf4a50141
UTIL: move mmap helpers into private header
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-01 10:39:18 +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
b6ae0b5c10
IPC: remove refcount'ing debug
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-30 20:53: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
90beaae095
IPC: add qb_ipcs_response_sendv()
...
iovec friendly response function
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-27 11:36:13 +11:00
Angus Salkeld
d4ad56b8b7
TIME: move tlist_nano_ functions into util
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-27 11:36:13 +11:00
Angus Salkeld
dd64dbe18d
RB: improve debug message
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-27 11:33:48 +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
cdc953384f
Fix or ignore splint errors
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-22 14:50:04 +11:00
Angus Salkeld
cf12f09b31
fix some build issues on FreeBSD
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-22 14:49:54 +11:00
Angus Salkeld
2549e5c24a
IPC: add a connection iterator.
...
So we can iterate over all connections on a service.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-21 21:48:29 +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
875a4f8d53
ATOMIC: fix the memory barrier setup.
...
This was horribly broken.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-20 11:31:44 +11:00
Angus Salkeld
ee84738c2d
IPC: remove sprintf where possible
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 22:36:40 +11:00
Angus Salkeld
9d8d6bfdce
LINT: get the lint target working.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 22:36:08 +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
f780aaea2d
HDB: remove locks and use atomic.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 10:24:04 +11:00
Angus Salkeld
84488fdb85
HDB: use qb_array.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 09:54:12 +11:00
Angus Salkeld
71952673ba
RB: fix the sem init logic (always use some semaphore).
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:55 +11:00
Angus Salkeld
548be1f66e
RB: use the semaphore to return chunks_used.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:55 +11:00
Angus Salkeld
6b1164effc
RB: remove locking from ringbuffer.
...
make ref_count atomic
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:55 +11:00
Angus Salkeld
c4614afa79
RB: prevent fd's from been leaked
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:55 +11:00
Angus Salkeld
6c03aa8cb6
IPC/RB: name the ringbuffer's files better.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:55 +11:00
Angus Salkeld
835422a25e
LOOP: use qbarray for poll_entries.
...
This fixes an issue where removing or adding entries
can cause a realloc() to move the entries and then a
qb_list_del() causes a SIGSEGV (next pointer is now
invalid).
qbarray does not use realloc() so does not suffer from this.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:54 +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
ec61d212d5
LIST/LOOP: allow empty list items but don't splice an empty head.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:54 +11:00
Angus Salkeld
97cdc99743
IPC: use atomic for ref counting.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-18 11:25:32 +11:00
Angus Salkeld
43d8b36518
Add atomic operations.
...
This was initially copied from glib. How ever I have
simplified it to only support proper atomic operations
with gcc builtin __sync calls. The backup is pthread_spin_lock().
I have also obviously namespaced the code to qb_.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-18 11:24:07 +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
3a1d26549d
LOOP: remove warning.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-16 21:43:37 +11:00
Steven Dake
4b58dda9fa
get_more_jobs: use qb_list_splice instead of iterating list and readding
...
oprofile picked up get_more_jobs as a heavy abuser of cpu cycles when running
with cpgbench. Typical cpgbench runs this function 37 million times. This
small optimization improves performance of corosync as well as reduces
cpu utilization used by this function.
Might look at tracking length of wait_head and job_head to avoid use of
qb_list_length as well (which also iterates).
Signed-off-by: Steven Dake <sdake@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-15 07:36:35 +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
12b2d87bfa
IPC: add q_len_get() to posix_mq & sysv_mq
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-13 21:37:59 +11:00
Angus Salkeld
dffc9262ed
IPC: move destroy() into ipcs.c (all were duplicated)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-13 21:23:07 +11:00
Angus Salkeld
0d9f8720b9
IPC: add qb_ipcc_sendv_recv() convenience function.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-13 10:01:30 +11:00
Angus Salkeld
d4c287a5f4
IPC: recv the messages available (not just one)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:53 +11:00
Angus Salkeld
c297a6b6a9
fix some valgrind warnings
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:53 +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
1a13b65de1
IPC: cleanup some formatting.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
99a8264550
IPC: improve send/recv error handling
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
33045932c5
IPC: accelerate process when rate_limit == FAST.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +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
95ac972b57
IPC: add peek & reclaim
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
57af215a96
Remove timer.c (rather use mainloop)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
487eb57dd2
LOOP: add epoll support
...
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
2d0d7fe0c9
RB: cleanup return codes frpm rb_peek()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
82c13bdd2b
IPC: make events always use socket notification
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
e7aad8fad5
IPC: use poll() to prevent a recv() blocking
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
e0f942bfee
IPC: teach event_recv() to take a timeout
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
9c0fa42f17
UTIL: add qb_timespec_add_ms()
...
add X milli seconds to a timespec.
add time defines to qbdefs.h
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +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
b95ed274bc
IPC: make internal message ids negative.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
dc618488d2
IPC: add a user context_get/set() functions.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
c1a3b0d029
IPC: add sendv() functions to handle iovecs.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
e79b3b41a8
IPC: make sure FD_CLOEXEC is set on all sockets
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
a7bf0518a7
add qbdefs.h with some common defines.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-04 10:04:01 +11:00
Angus Salkeld
4df303f374
POLL: add missing fuction.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-02 21:37:00 +10: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
ac6ed91a7d
POLL: gracefully handle running out of file descriptors.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-01 22:57:02 +10:00
Angus Salkeld
93290ebbbd
POLL: Allow modifying POLLIN/POLLOUT state in another thread.
...
while the main thread is blocked in poll system call.
(ported from corosync)
Author: Steven Dake <sdake@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-01 22:56:56 +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
f2c80cb086
RB: add qb_rb_chown()
...
change the ownership of the two mmap'ed files.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-30 20:07:35 +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
a54067bffa
IPC: pack sysv messages into multiple queue items
...
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
682ff31540
IPC: rename dispatch queues to event queues.
...
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
64b4aac413
IPC: un-const the data pointer in recv()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-29 14:32:51 +10:00
Angus Salkeld
432e906de8
POLL: check for stop_requested before poll() as well.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-29 10:52:41 +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
eae6c35157
IPC: linux & bsd mq_open returns a poll'able file descriptor.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-06 16:50:19 +10:00
Angus Salkeld
1b84f99ef7
Lindent most c files again.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-06 16:50:05 +10:00
Angus Salkeld
e558ca0d39
IPC: fix crash on failed auth
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-06 16:49:35 +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
5221880227
automake: check for more headers
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-08-22 22:06:59 +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
fc55f5c5f9
RB: make the timedwait() functions more consistent
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-07-28 21:14:36 +10:00
Angus Salkeld
f04f1abcf0
POLL: add a job API to process non-fd items.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-07-28 21:12:11 +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
cdb9d32de4
unsigned long long -> uint64_t
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-22 11:28:56 +10:00
Angus Salkeld
edf994dc5c
change name of ringbuffer.h to ringbuffer_int.h
2010-06-22 11:26:34 +10:00
Angus Salkeld
2432ca85b9
list: rename QB_DECLARE_LIST_INIT -> QB_LIST_DECLARE
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-16 13:24:14 +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
87f204469a
ipc: convert int -> int32_t; unsigned int -> uint32_t
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-15 14:46:52 +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
ffd5975da3
ipcc: remove unneccessry goto
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-15 12:56:33 +10:00
Angus Salkeld
a4c1f5445e
rb: fix handling of EINTR from sem_wait
...
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
e7975a77e3
rb: add a get name function
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-12 11:25:50 +10:00
Angus Salkeld
d9f93c15e5
rb: rename qb_rb_chunk_writable* -> qb_rb_chunk_
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-12 09:10:49 +10:00
Angus Salkeld
ae90c0d76e
rb: cleanup of names and log messages
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-11 21:21:29 +10:00
Angus Salkeld
595bd54502
util: move some handy macros into qbuil.h
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-11 20:13:42 +10:00
Angus Salkeld
cd3c4a5ca6
rb: organise the locks/sems a bit better
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-11 12:00:43 +10:00
Angus Salkeld
e6d5f32f9f
Bring some changes across from corosync.
...
My coverity fixes and honzas fixes.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-11 09:51:53 +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
6255c651df
Fix the installation of libqb.pc
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-31 11:21:03 +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
a4af633d42
Fix the new inter-library dependancy.
...
http://old.nabble.com/relinking-error-td27796838.html
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-26 12:46:53 +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
Angus Salkeld
396fb4f375
Add a library logging function.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-25 15:07:54 +10:00
Angus Salkeld
5f7d3749c9
Add a util library with locking wrappers.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-25 15:06:41 +10:00
Angus Salkeld
caecbe6542
Re-license to LGPL 2.1
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-25 06:11:59 +10:00
Angus Salkeld
74a7a49354
ipc: add a non-blocking send function.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-29 14:47:42 +10:00
Angus Salkeld
3eb313a848
ipc: add common types to qbipc_common.h
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-29 11:23:35 +10:00
Angus Salkeld
e9467c988c
ipc: remove uneccessary version compatibilty
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-29 11:22:45 +10:00
Angus Salkeld
e394431ed4
hash: improve the error handling in key_set()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-16 11:42:31 +10:00
Angus Salkeld
40f235a889
libtool and code re-structure
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-15 23:25:29 +10:00
Angus Salkeld
c6134b367c
add a unit test for hash & cleanup.
...
Fix make distcheck
Add qbhash.h to the makefiles
Fix make rpm.
Make sure the makefiles are generatd for hash
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-15 12:19:08 +10:00
Steven Dake
82e984fe38
Add an initial implementation of a hash table.
...
The hash table implementation is somewhat unique in that I plan to add graph
functionality to allow hash entries to be linked between other hash
entries to provide a mechanism to structure data within a hash table.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-15 08:00:56 +10:00
Angus Salkeld
b64457e19e
add logsys from corosync.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-20 21:40:03 +11:00
Angus Salkeld
2bea1f4f65
Add wthread & queue.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-20 21:23:19 +11:00
Angus Salkeld
428003888a
add ipcs from corosync
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 15:04:21 +11:00
Angus Salkeld
14db8db928
clean up lib.versions files
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 14:42:32 +11:00
Angus Salkeld
ceff27f370
Add ipcc from corosync
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 14:42:25 +11:00
Angus Salkeld
c7e93f2f5c
add the plugin library.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 14:36:04 +11:00
Angus Salkeld
3b8ba3ba5d
tsafe: replace _XOPEN_SOURCE with HAVE_(function)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 14:33:02 +11:00
Angus Salkeld
2c7484a1af
remove ipc so from makefiles
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 14:32:49 +11:00
Angus Salkeld
1aee5e128b
Add timer.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 14:25:35 +11:00
Angus Salkeld
81facf8267
Add poll, list & tlist
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-11 15:54:03 +11:00
Angus Salkeld
69d77500df
Initial Commit.
...
-autotools build system
-tsafe
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-11 14:19:39 +11:00