Angus Salkeld
1c9104e334
LOG: copy the function/filename for dynamic callsites
...
callsites originate from the assumption that the function/filename/format
are all statically allocated. When moving to dynamic callsite we kept
this assumption. But people are now passing in function/file names that
later get free'd. So we need to make sure that they stay persistant by
allocating them ourselves.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-03-20 17:10:35 +11:00
Angus Salkeld
c445c06620
Properly discover SO_NOSIGPIPE and MSG_SIGNAL
...
bug #57
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-03-12 21:13:47 +11:00
Angus Salkeld
75a550d8d3
IPC: fix call to QB_SUN_LEN
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-03-12 20:45:47 +11:00
Angus Salkeld
2125310c93
rpl_sem: make destroy more compliant
...
don't block completely on the sem_wait(), but chop the waits
into 1 sec blocks so the destroy can have an opertunity to complete.
fixes bug #55
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-19 12:40:06 +11:00
Angus Salkeld
6ba054713e
RB: make the "sem" abstraction into a notifier
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-18 23:25:10 +11:00
Angus Salkeld
59243fb68c
IPC: clean up the connection state checking
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-18 23:02:30 +11:00
Angus Salkeld
31d9f0900d
Use dgram sockets for message oriented communications
...
This is to prevent partial sends and gettting stuck in
retry loops.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-18 20:51:33 +11:00
Angus Salkeld
481bd0cf86
IPC: don't interpret EMSGSIZE and ENOMSG as a disconnect
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-18 20:51:33 +11:00
Angus Salkeld
3d7774816e
POLL: prevent a spin if the fd is not removed from the mainloop
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-18 20:51:33 +11:00
Angus Salkeld
9d2eca251b
IPC: seperate ipc_us.c into 2 files
...
Seperate into a setup file and a socket backend file, it was getting messy
and confusing. Also preparing for using DGRAM sockets.
This should not result in any logical changes.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-06 11:21:05 +11:00
Angus Salkeld
aa43bb94d1
IPC: move utility functions to unix.c
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-06 11:08:38 +11:00
Angus Salkeld
dde6a46a83
IPC: make sure we return a consistent error when the message is too big.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-01-25 11:20:19 +11:00
The Quarterback Library Release Team
848242a786
Bump the version to 0.14.4
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2013-01-17 14:06:48 +11:00
Angus Salkeld
45f181125c
LOG: prevent the last char of the blackbox message from getting lost.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-01-17 13:55:48 +11:00
Takeshi MIZUTA
37a6e7a5f1
Add the processing which remove notifier at skiplist_destroy function
2013-01-15 01:57:29 +09:00
Takeshi MIZUTA
c684cdb55e
Add the processing which remove hash node and notifier at hashtable_destroy function
2013-01-14 03:39:47 +09:00
Takeshi MIZUTA
4d1a98ad76
Unify to QB_TRUE/QB_FALSE a boolean value
2013-01-11 02:01:06 +09:00
Takeshi MIZUTA
96e504f305
Unify the list processing with qb_list function
2013-01-09 02:04:20 +09:00
miz-take
d365310882
Fix return code which is an error occurred at pthread function
2013-01-06 03:08:33 +09:00
Angus Salkeld
739faa54fe
LOG: fix truncation in some messages that get padded.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-01-04 15:55:19 +11:00
Angus Salkeld
e07eccd6a6
Fix the blackbox formatter when specifing the string len/precision
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-19 10:51:54 +11:00
Angus Salkeld
aed8fe942e
Fix strlcpy and strlcat functions
...
These were not behaving as the man pages described.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-19 10:42:08 +11:00
Angus Salkeld
fe45c27ea6
IPC: don't over log on disconnect
...
Thanks grueni: https://github.com/asalkeld/libqb/pull/43
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-10 10:46:01 +11:00
Angus Salkeld
c69713e5f9
Make sure we don't use the format string whilst it is getting changed.
...
Just add a rwlock around the usage.
Move qb_log_format_set() to log_format.c to make this easier.
Fixes #45
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-10 10:32:31 +11:00
Angus Salkeld
813dfb5fd2
ptrie: deref the current node in trie_iter_free()
...
If free'ing the iterator before getting to the last
node make sure we de-ref the current node. Else we
will not be able to delete the node.
fixes #44
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-06 11:59:33 +11:00
Angus Salkeld
30a7871646
LOG: fix the format comparison to avoid generating multiple entries.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-29 17:31:05 +11:00
Angus Salkeld
a5795f7d45
LOG: set the return code when calloc fails
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-23 10:24:56 +11:00
Angus Salkeld
709b32de43
IPC: call poll if we are mid message and get EAGAIN
...
So just manually call us_ready (poll) with a timeout of 50ms
to prevent cpu spin.
Also update qb_ipc_us_recv() to be simerlar.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-12 19:38:20 +11:00
Angus Salkeld
14f0250a89
Remove extra ";"
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-09 10:28:29 +11:00
Angus Salkeld
b535ef241b
IPC: set the error more correctly when qb_sys_mmap_file_open() fails.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-09 10:28:06 +11:00
Angus Salkeld
839d14f0ec
Make sure that mmap'ed files smaller than a page size are written to.
...
This is a test to make sure that there is actually enough memory
to back the requested shared memory.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-09 10:15:25 +11:00
The Quarterback Library Release Team
92ada8c4d1
Bump the library version.
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-10-29 10:02:04 +11:00
Andrew Beekhof
e771439c1c
IPC: Pass the timeout to poll() if the recv function returns EAGAIN
2012-10-23 11:14:59 +11:00
Angus Salkeld
6e130725e4
LOG: make the format comparison safe and sane
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-23 10:35:05 +11:00
Angus Salkeld
a623af9696
LOG: don't break on empty callsites, just ignore them
...
else we might miss some callsites.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-23 10:34:23 +11:00
Angus Salkeld
435d1dbce2
LOG: use the array callback to register new callsites
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-23 10:33:00 +11:00
Angus Salkeld
5e955579cb
array: add a mechanism to get a callback when a bin is allocated
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-23 10:31:47 +11:00
Angus Salkeld
79059bcae3
Solaris based operating systems don't define MSG_NOSIGNAL and SO_NOSIGPIPE.
...
They return SIGPIPE when send is used with a closed socket. A SIGPIPE handler
must be used or SIGPIPE should be set ignored with SIG_IGN. In this case send
returns -1 instead of a SIGPIPE. The setting to ignore SIGPIPE is global and
should be used only where it is absolutely necessary.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-22 11:15:05 +11:00
Angus Salkeld
bcba4a2983
Fix a crash in ptrie if you iterate over the map in the deleted notifier.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-09-12 10:39:17 +10:00
Angus Salkeld
aedcb97690
Make sure atomic's are initialized (for non-gcc atomic).
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-09-11 14:42:04 +10:00
The Quarterback Library Release Team
74b7c6e990
Bump the version to 0.14.2
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-09-10 10:58:14 +10:00
Виноградов Василий
f44efc4529
Get libqb building on cygwin.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-09-07 09:14:07 +10:00
Jeremy Fitzhardinge
20a7075862
ipc_us: slightly more robust cmsg handling
...
Cope with multiple cmsg structures in the received msg.
2012-09-05 17:57:23 -07:00
Jeremy Fitzhardinge
6d75ccba6f
ipc_us: on Linux, set SO_PASSCRED on the sending socket too
...
Linux doesn't pass credential information by default, only when it has
been specifically requested with SO_PASSCRED. This means there's a
race between when the ipc server side has set up and is listening on the
socket, and when the client may connect; if the client connects and sends
its first message before the server has set SO_PASSCRED on the socket,
then there will be no ucred information associated with the message.
The fix is to set SO_PASSCRED on the client socket as well, so that
the message will always have a ucred associated with it when the server
reads it.
Without this change, around 1% of cpg_model_initialize() calls fail
with CS_ERR_ACCESS.
(This Linux behaviour was introduced just on a year ago in
16e5726269611b71c930054ffe9b858c1cea88eb "af_unix: dont send
SCM_CREDENTIALS by default".)
2012-09-05 17:51:49 -07:00
Jeremy Fitzhardinge
b79f8ceb1e
ipc_us: clear request unused fields
...
Clear unused request fields and padding so that valgrind doesn't complain
about undefined data being sent over the socket.
2012-09-05 17:01:55 -07:00
Angus Salkeld
9d33e1f40d
LOG: fix qb_vsnprintf_deserialize()
...
the strlcat was not call correctly, it needs the
original string to find the end and return the
correct length.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-09-05 18:35:19 +10:00
Jeremy Fitzhardinge
30139366ed
blackbox: fix 64-bit big-endian issues
...
Two issues:
1. when writing out the function name length, don't just write the 4 MSB
of the size
2. when reading the time, don't just use the 4 MSB of the time as the
timestamp; the log contains a full time_t, so we may as well use it.
2012-08-31 13:21:00 -07:00
Angus Salkeld
c7810b38b1
Remove IPC_NEEDS_RESPONSE_ACK and turn off shm ipc on solaris
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-31 14:53:38 +10:00
Angus Salkeld
ffcb11f93d
Some improvements to kqueue usage.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-31 13:32:11 +10:00
Angus Salkeld
b6e0b5b431
kqueue: drop log message to trace.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-30 23:12:36 +10:00
Angus Salkeld
988c1e259c
Fix splint warning
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 23:29:05 +10:00
Angus Salkeld
cceb4e2e5f
Avoid strcpy() use strlcpy() instead.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 22:31:57 +10:00
Angus Salkeld
95840eb3aa
Fix kqueue complile warnings
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 22:31:29 +10:00
Angus Salkeld
d92bfa2b0e
openbsd doesn't have EBADMSG
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 22:30:58 +10:00
Angus Salkeld
a55554efb1
LOG: change qb_vsprintf_serialize() into qb_vsnprintf_serialize()
...
This is to prevent overwriting the ringbuffer.
Also remove stpcpy() as it is not used anymore.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 21:40:40 +10:00
Angus Salkeld
10045dd561
Some missing pshared semaphore checks
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 12:26:47 +10:00
Angus Salkeld
873e467cf8
Cleanup the checks for pshared semaphores
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 10:22:56 +10:00
Angus Salkeld
fb76492880
RB: change the #error to ENOTSUP if no usable shared process sem
...
This is mainly on mac.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-28 21:30:43 +10:00
Angus Salkeld
b6839bacfe
LOOP-KQUEUE: fix reference before assignment.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-28 14:39:28 +10:00
Fabio M. Di Nitto
5e16bcd004
build: fix libqb.pc creation and make maintainer-clean
...
LIB_RT is unnecessary around. AC_CHECK_LIBS will do the right thing
similar for the other libs that are all exported via LIBS
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-08-27 15:07:36 +02:00
Angus Salkeld
248259f12b
LOG: Make sure the semaphores are initialized.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-27 19:16:04 +10:00
Angus Salkeld
50632154ed
Catch disconnected sockets on Solaris
...
It seems like poll() was not producing a POLLHUP
so we rely on qb_ipc_us_recv() returning -ENOTCONN.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-24 11:49:07 +10:00
Jeremy Fitzhardinge
4a1e24ee3e
Don't free rb->shared_hdr in qb_rb_create_from_file()
...
Since qb_rb_close() frees it by munmapping it.
2012-08-23 10:14:11 -07:00
Jeremy Fitzhardinge
069f4e3190
Check error return of qb_ipcs_uc_recv_and_auth()
...
If it fails, then &ugp isn't initialized.
2012-08-23 10:12:09 -07:00
Angus Salkeld
70c8df9a19
Work around debian not setting the arch path in splint.
...
So just adding both i386 and x86_64 to the path.
Ref: http://lists.gnu.org/archive/html/gpsd-dev/2012-05/msg00221.html
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-22 10:58:29 +10:00
David Vossel
d5b762e441
LOG: Invoke custom log filter function if tag changes
2012-07-19 17:18:46 -05:00
Jim Meyering
c60f5012ea
ipcs: avoid use-after-free for size-0 || disconnect-request
...
Hi,
Glancing through coverity-reported issues,
I saw that this one required attention:
From 70f1f689022321710405f16dc45b3df30c22bc59 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 18 Jul 2012 17:34:17 +0200
Subject: [PATCH] ipcs: avoid use-after-free for size-0 || disconnect-request
spotted by coverity:
http://libqb.org/html/0.14.1/coverity/1/265ipcs.c.html#error
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-19 08:19:22 +10:00
The Quarterback Library Release Team
5470bf5625
Bump the version to 0.14.1
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-07-17 22:03:31 +10:00
Angus Salkeld
e5be0396a7
RB: set the new read pointer after clearing the header.
...
This is to prevent a situation where a fast writer will
write their new chunk between setting the new read pointer
and clearing the header.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 21:18:47 +10:00
Angus Salkeld
3feb3b6b8f
RB: improve the debug print outs
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 20:45:29 +10:00
Angus Salkeld
b9a992a5d3
RB: be more explicit about the word alignment
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 19:37:52 +10:00
Angus Salkeld
15d0291a8a
RB: cleanup the macros for wrapping the index
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:38:22 +10:00
Angus Salkeld
6e1d9054c3
RB: use sem_getvalue as a tie breaker when read_pt == write_pt
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:38:22 +10:00
Angus Salkeld
bdc63cdf1a
RB: if read or peek don't get the message then re-post to the semaphore
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:38:22 +10:00
Angus Salkeld
deddaea86c
RB: convert the rb_peek() status into a recv like status.
...
peek returns 0 on no data, so convert that to -EAGAIN.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:22:31 +10:00
Angus Salkeld
121abe3dbe
RB: use internal reclaim function
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:22:26 +10:00
Angus Salkeld
3b31023d84
IPC: use calloc instead of malloc to fix valgrind warnings
...
This is to cleanup some valgrind warnings.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:22:17 +10:00
Angus Salkeld
740f9df7ac
Fix a valgrind error.
...
just use the receive buffer, as it will be big enough.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-14 22:29:25 +10:00
The Quarterback Library Release Team
1c2b77f005
Bump the version to 0.14.0
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-06-22 16:29:32 +10:00
Angus Salkeld
b9f8ec34df
LOG: fix threaded logging.
...
This has been broken for a year - yikes!
Thanks to Voznesensky Vladimir for spotting it.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-14 11:01:52 +10:00
Angus Salkeld
22569f51ba
Add user control of the permissions that are set on the shared mem files
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-13 08:21:09 +10:00
Andrew Beekhof
e70e7908f0
LOG: Restrict string trucation during serialization to when a precision is specified
2012-06-07 15:02:06 +10:00
Andrew Beekhof
bb2e307241
LOG: Gracefully fail when the caller exceeds QB_LOG_MAX_LEN
2012-06-07 14:41:03 +10:00
Andrew Beekhof
9b0bb4e80e
LOG: Observe field widths when serializing string arguments
2012-06-07 14:40:34 +10:00
Angus Salkeld
3369581066
RB: use the same mechanism in reclaim as read/peek to detect end-of-ring
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-07 12:02:32 +10:00
Angus Salkeld
9520fc4501
RB: fix wrong sem_flg IPC_NOWAIT option
...
The #ifdef was the wrong way around causing
the sem to return early with EAGAIN.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-06 16:22:58 +10:00
Angus Salkeld
194b93678f
Open shared mem file in /dev/shm only for linux
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-06 15:31:51 +10:00
Angus Salkeld
c0f52fb5c2
Don't use msg_flags on solaris (recvmsg).
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-06 15:29:10 +10:00
Angus Salkeld
73731f0643
IPC: if the server returns EAGAIN or ETIMEOUT the check the connection
...
Mainly useful for shm, as the ringbuffer doesn't know the state
of the connection.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-06 13:46:58 +10:00
Angus Salkeld
b52f2e37b3
LOG: make it possible to fsync() on each file log.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-05 12:07:35 +10:00
Angus Salkeld
460cc70a8b
IPC: make sure that the created callback happens before dispatches
...
This only happened on the socket ipc type.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-04 21:45:28 +10:00
Angus Salkeld
9956fe29ff
LOG: fix the printing of %p in the blackbox
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-04 14:54:39 +10:00
Angus Salkeld
1e81530332
IPC: On bsd's use the notifier for responses
...
The point of this is to catch connection failures
more reliably.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-01 11:12:44 +10:00
Angus Salkeld
44f61b23bb
IPC: interpret ECONNRESET and EPIPE as ENOTCONN
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-01 10:15:36 +10:00
Angus Salkeld
35a4421d23
cleanup some warnings
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-31 22:18:04 +10:00
Angus Salkeld
9f90b16d06
blackbox: fix %p formatting
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 23:16:49 +10:00
Angus Salkeld
d280ddd6e4
LOG: put all fields in the blackbox (added priority and tags)
...
Fixes #36
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 22:23:22 +10:00
Angus Salkeld
85b39906a9
RB: fix compiler warning.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 19:10:13 +10:00
Angus Salkeld
4208a4b88b
Add replacement function stpcpy
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 19:10:13 +10:00
Angus Salkeld
fe8014b379
Use AC_FUNC_STRERROR_R and STRERROR_R_CHAR_P
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 14:41:43 +10:00
Angus Salkeld
2b49dc7030
Move some conditional defines into code (from the configure script)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 14:33:03 +10:00
Angus Salkeld
70a9623a48
Remove message queues
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 13:41:04 +10:00
Angus Salkeld
aaae0a3c31
Check for union semun properly
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 13:35:48 +10:00
Angus Salkeld
531f7cdb7a
Blackbox: provide more space for log messages when reading from the blackbox.
...
This is to allow for the header (16bytes and variable length function).
so if someone has a function name > 400 chars it will break. I
recon that will do:)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 13:34:15 +10:00
Andrew Beekhof
77fa3650dd
RB: Read the file size into an initialized variable of the correct size
2012-05-28 12:25:10 +10:00
Angus Salkeld
e0bc3a15ce
RB: to be safer save the read and write pointers at the top of the blackbox
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-25 14:01:19 +10:00
Jim Meyering
32abe38ffd
avoid unwarranted use of strncpy: use memcpy instead
...
* lib/log_format.c (qb_vsnprintf_deserialize): We know that there are
len or more non-NUL bytes in the source string, so it's clearer to
use memcpy.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 20:47:57 +10:00
Angus Salkeld
a8405ab06d
blackbox: fix the print_from_file()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 19:22:55 +10:00
Angus Salkeld
4fdabe5bed
RB: add an option to not use any semaphores
...
(brought over from the "speed" branch)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 19:16:59 +10:00
Angus Salkeld
0327b6aa86
LOG: tweak the blackbox format string
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 14:37:05 +10:00
Angus Salkeld
c56427e19e
LOG: accept NULL strings into the blackbox
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 14:16:54 +10:00
Angus Salkeld
072e224331
LOG: protect close and reload from calling log
...
Logging during these operations is temporarly disabled.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 13:06:51 +10:00
Angus Salkeld
0458c5ccd2
IPC: log the connection description in all logs
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-16 13:59:12 +10:00
Angus Salkeld
78374c2ed3
IPC: only modify the dispatch if we get EAGAIN
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-16 13:19:41 +10:00
Jan Friesse
a4411105a7
Correctly display timestamp in blackbox
...
On little endian architectures where time_t is 64-bit long integer could
happen, that instead of displaying correct timestamp, random data was
used, because of memcpy.
Solution is to memcpy to real 32-bit variable and then assing this value
to timestamp. This will let compiler decide endianity and store number
correctly.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-12 22:04:59 +10:00
Angus Salkeld
955d43eae6
Add a more verbose version of the library versioning text.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 20:45:13 +10:00
Angus Salkeld
b3aa86dc42
Bump the library version to 0.13.0
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 20:44:10 +10:00
Angus Salkeld
6d2137fd8d
Remove unneccessary __attribute__ ((aligned(8))) from internal headers
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 20:31:15 +10:00
Angus Salkeld
908bdfd172
IPC: add a new function to get (and alloc) the extended stats.
...
This should handle any further additions to the stats
as the library allocs the struct.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 20:20:29 +10:00
Angus Salkeld
c221922291
Revert "Add the event queue length to the connection stats."
...
This reverts commit 6b7da3f531
.
2012-05-10 16:09:48 +10:00
Angus Salkeld
cf93d256ca
IPC: cleanup better on a failed client connect.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 14:22:31 +10:00
Angus Salkeld
e6536b222b
IPC(soc): be more consistent with control struct size
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 14:13:52 +10:00
Angus Salkeld
cbb6495454
IPC: kill a compiler warning
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 13:38:32 +10:00
Angus Salkeld
1d7a716849
IPC(soc): pass in the correct size into munmap()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 13:38:02 +10:00
The Quarterback Library Release Team
0b8aeb66c8
Bump the lib version to 0.12.0
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-05-10 11:48:46 +10:00
Angus Salkeld
c566421df9
rb: cleanup the semaphores
...
- the way they are selected
- rpl_sem.c the error handling
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 10:39:43 +10:00
Angus Salkeld
8ed5f55990
Cleanup the .gitignore files
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-09 21:43:58 +10:00
Angus Salkeld
916440d08d
Remove HZ and use sysconf instead.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-09 21:38:38 +10:00
Angus Salkeld
259021414a
SUN_LEN() macro is present if __EXTENSIONS__ is defined on Illumos
...
A bit reworked but originally from Igor Pashev:
84c47f8160
Note: __EXTENSIONS__ also defines _GNU_SOURCE, so removing it as well.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-09 21:37:04 +10:00
Igor Pashev
9b3822dd2a
PF_UNIX is a POSIX standard name
2012-05-09 18:56:25 +10:00
Igor Pashev
62e070a720
Test for log facility names
2012-05-09 18:56:08 +10:00
Angus Salkeld
b6945e5eb6
IPC: drop log message to debug.
...
this can be noisy when there are a lot of transient
connections.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-09 11:45:51 +10:00
Angus Salkeld
7c2e632be0
IPC: fix retrying of partial recv's and sends.
...
Move to send() instead of sendmsg() as it's easier
to track resending partial messages.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-03 21:24:02 +10:00
Angus Salkeld
c2651bb9bf
IPC: initialize enough shared mem for all 3 one way connections.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-03 08:20:59 +10:00
Angus Salkeld
494293a97b
IPC: keep retrying to recv the socket message if partially recv'ed (part 2)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-02 16:39:03 +10:00
Angus Salkeld
f2916c7576
IPC: keep retrying to recv the socket message if partially recv'ed
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-02 16:03:23 +10:00
Angus Salkeld
72938081c0
IPC: handle the server shutdown better
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-02 16:00:05 +10:00
Angus Salkeld
9f09aba8dd
IPC: handle a connection disconnect from the server better
...
Only problem with SOCKET.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-02 10:15:19 +10:00
Angus Salkeld
78fb4ad682
IPC: make it possible to send events in the connected callback.
...
This was only a problem with QB_IPC_SOCKET.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-01 20:09:21 +10:00
Angus Salkeld
6b7da3f531
Add the event queue length to the connection stats.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-01 13:22:16 +10:00
Angus Salkeld
b29326a363
IPC: add a is_connected client side function.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-01 12:43:22 +10:00
Angus Salkeld
4550cc9e45
Remove unused local variable
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-01 09:13:04 +10:00
Angus Salkeld
9e3c2ea33d
IPC: change the socket recv function to read the response header.
...
It needs to only recv the size of this message, else we recv more
than one message and effectively drop messages (hidden at the end
of the current message).
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-30 15:49:42 +10:00
Angus Salkeld
3f4a175312
IPC: make it possible for a root client to talk to a non-root server.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-30 08:25:57 +10:00
Angus Salkeld
fbd05ba1d2
IPC: make sure ipc (socket) clients can connect to a server running as root.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-26 21:35:38 +10:00
Angus Salkeld
0e140bbf0f
IPC: allow qb to bump the max_message_size
...
I think this is more user friendly.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-23 20:42:45 +10:00
Angus Salkeld
72033f2b4f
IPC: check for a sane minimum max_message_size
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-23 19:57:26 +10:00
Angus Salkeld
316fd95e00
add rpl_sem.h loop_poll_int.h to noinst_headers
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-23 19:10:43 +10:00
Angus Salkeld
239ddc067f
Handle errors more consistently
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 21:57:49 +10:00
Angus Salkeld
b650bf29d6
call recv_ready on socket types
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 21:57:49 +10:00
Angus Salkeld
d80f218133
Handle a recv of size 0
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 21:57:49 +10:00
Angus Salkeld
4b7581e514
make bsd shm path better by default.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 20:55:37 +10:00
Angus Salkeld
481b354794
Fix kqueue on freebsd.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 20:55:37 +10:00
Angus Salkeld
7a09cdae67
Fix kqueue compiling.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 01:37:00 +10:00
Angus Salkeld
26491555ef
POLL: seperate out the poll/epoll and add kqueue
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 00:26:20 +10:00
Jan Friesse
e2fe03e491
Don't link with setpshared if unavailable
...
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-03 21:23:18 +10:00
Jan Friesse
7b13d09afb
Use MADV_NOSYNC only on systems where available
...
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-28 09:28:42 +11:00
Jan Friesse
77787d49e5
Use SCHED_BATCH only on platforms where available
...
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-28 09:28:42 +11:00
Angus Salkeld
c97113bd83
Fix a bug introduced by the bsd patch.
...
I missed the non-native case.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-27 20:57:10 +11:00
Angus Salkeld
3d291540b1
Cleanup the selection of semaphores to use
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-27 20:57:06 +11:00
Angus Salkeld
d6883981e3
Fix some leaks in the logging.
...
Mainly for valgrind purposes.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-27 16:42:38 +11:00
Angus Salkeld
1af214d91d
Try and improve the portability on bsd variants.
...
Also add a QB_IPC_NATIVE type that selects the best ipc type available.
Signed-off-by: Angus <angus@anguss-mac-mini>
2012-03-24 22:43:37 +11:00
The Quarterback Library Release Team
50f07abcfe
Bump the version to 0.11.1
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-03-11 22:17:43 +11:00
Angus Salkeld
4f5d55a48e
LOOP: remove some old timerfd code.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 20:20:04 +11:00
Angus Salkeld
082a04e288
LOOP: when new jobs are added they are added to the head instead of the tail.
...
We must add new jobs to the tail of the job queue otherwise
old jobs will get stuck in the job list.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 19:32:37 +11:00
Angus Salkeld
9294ebfa57
LOG: Now the array is self locking we can make the lookup array dynamic
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 12:34:50 +11:00
Angus Salkeld
4df255d919
Add locking to the array when growing.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 12:34:50 +11:00
Angus Salkeld
58bc8e6bb4
IPC: make the _request_q_len_get() function more obvious.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 12:34:50 +11:00
Angus Salkeld
bd39cd4d20
IPC: fix multiple receives from qb_ipc_us_recv()
...
So this function is used by the QB_IPC_SOCKET transport
and is used like recv(,, max_size_of_my_rx_buf,,);
But in the shared mem transport it is used to recv
a notification of something in shared mem is available
in this case we really want to make sure we recv all
the notifications. So I have split these into 2 functions.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 12:21:38 +11:00
Angus Salkeld
c2f5f94312
IPC: make sure that the wrong union member is not written to.
...
Move the connection type into the one_way struct. Seem
like a more obvious place for it next to the union.
Also it will help prevent issues like in qb_ipc_us_recv()
where there is a rather dodgy access of ctl->sent.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 12:18:02 +11:00
Angus Salkeld
6d0d8bb670
TIMER: check for null timer handle
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 12:17:03 +11:00
The Quarterback Library Release Team
418471e6c1
Bump the version to 0.11.0
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-03-07 21:11:40 +11:00
Angus Salkeld
a9cdbbef8e
ARRAY: cleanup the pointer sizeof()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-07 20:42:51 +11:00
Angus Salkeld
430c038d36
LOG: make the log arrays manually grow-able since we need to lock the calls.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-07 12:48:43 +11:00
Angus Salkeld
2ae58d2472
RB: fix test failure on ppc
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-07 11:37:12 +11:00
Angus Salkeld
9027c3531b
RB: change the name of the size to word_size to be more clear
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-07 10:34:19 +11:00
Angus Salkeld
98e97129d8
LOOP: fix deletion of signal handlers when they are pending
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-06 22:28:09 +11:00
Angus Salkeld
ab5da6ff1f
LOOP: signal handlers were always added as high priority.
...
This now adds them as requested by the user.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-06 22:01:12 +11:00
Angus Salkeld
d327ef7928
LOG: expose the mechanism to get a dynamic callsite.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-05 16:11:30 +11:00
Angus Salkeld
7a59f73d53
Revert part of my COARSE grained timer commit
...
The stopwatch and timers use qb_util_nano_current_get()
and need to be accurate. This does't seem to effect
performance at all so no loss there.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-24 12:29:57 +11:00
Angus Salkeld
002f009941
Remove timerfd usage and go back to timelist.
...
timefd is using too much cpu and it is using up
file descriptors.
timelist is also more portable and now I have less
code to maintain.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-24 11:40:45 +11:00
Angus Salkeld
4356fbf577
UTIL: if possible use COARSE resolution clocks - they are much faster.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-24 11:25:55 +11:00
Angus Salkeld
0d21be245b
ARRAY: save memory (in the bins array) and allow holes in the array
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-22 17:30:19 +11:00
Angus Salkeld
e37f801170
LOOP: add qb_loop_timer_is_running()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-22 11:08:42 +11:00
Angus Salkeld
1d857f5b51
LOOP: allow stop() and run() to be called with NULL loop instance.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-20 14:46:43 +11:00
Angus Salkeld
4dbfebbdbc
LOG: add stdout target
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-20 14:46:43 +11:00
Angus Salkeld
70f1eb8130
LOOP: add a function to delete jobs
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 22:18:43 +11:00
Angus Salkeld
b298e01abc
LOG: remove debug printf's
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 17:38:59 +11:00
Angus Salkeld
504e000cb8
LOG: add a hostname %H format specifier.
...
This is useful when logging to file on a cluster.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 17:34:45 +11:00
Angus Salkeld
ff0d89721f
LOG: Add qb_log_filter_fn_set()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 15:40:58 +11:00
The Quarterback Library Release Team
1c8a9d6461
Fix "make distcheck" add include path to AM_CPPFLAGS
...
strl* files are built a bit differently and need the global
flags
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-02-14 21:48:53 +11:00
The Quarterback Library Release Team
b2c9cb6cb3
Bump the version to 0.10.1
...
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-02-14 21:33:21 +11:00
Angus Salkeld
42de03038e
clang: Remove unused code
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-14 17:27:26 +11:00
Angus Salkeld
2a0cdd8f5f
RB: add a debug message if trying to read a message of the wrong size
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-14 16:43:50 +11:00
Angus Salkeld
d633b4e2fa
IPC: split up the recv into chuncks of 2 seconds.
...
This is because semaphores can't detect the other side has
failed/exited. So we rely on the socket poll to tell us.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-14 16:42:59 +11:00
Angus Salkeld
b5c66cab7c
Be more consistent with the internal logs.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-14 12:43:42 +11:00
Angus Salkeld
1e4b33c9cf
LOOP: make it possible to pass in NULL as the default loop instance
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-10 14:47:49 +11:00
Angus Salkeld
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
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