Commit Graph

266 Commits

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