Commit Graph

346 Commits

Author SHA1 Message Date
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