Commit Graph

773 Commits

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