Commit Graph

50 Commits

Author SHA1 Message Date
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
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
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
Виноградов Василий
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
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
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
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
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
a215e856d8 LOG: fix splint warnings
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-27 21:01:11 +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
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
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
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
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
dd64dbe18d RB: improve debug message
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-27 11:33:48 +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
548be1f66e RB: use the semaphore to return chunks_used.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:55 +11:00
Angus Salkeld
6b1164effc RB: remove locking from ringbuffer.
make ref_count atomic

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:55 +11:00
Angus Salkeld
c4614afa79 RB: prevent fd's from been leaked
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:55 +11:00
Angus Salkeld
6c03aa8cb6 IPC/RB: name the ringbuffer's files better.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:55 +11:00
Angus Salkeld
45c41935b7 RB: return EAGAIN not ENOMEM if no space on the rb.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:53 +11:00
Angus Salkeld
8d3ec80c19 RB: add support for shared user data.
(I need this for flow control)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:53 +11:00
Angus Salkeld
2d0d7fe0c9 RB: cleanup return codes frpm rb_peek()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
82c13bdd2b IPC: make events always use socket notification
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
f1f301724b IPC: improve resource cleanup/shutdown
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
a7bf0518a7 add qbdefs.h with some common defines.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-04 10:04:01 +11:00
Angus Salkeld
f2c80cb086 RB: add qb_rb_chown()
change the ownership of the two mmap'ed files.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-30 20:07:35 +10:00
Angus Salkeld
1b84f99ef7 Lindent most c files again.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-06 16:50:05 +10:00
Angus Salkeld
d27e50c58a Define new return status policy
Good >= 0 (0 = good, or positive value)
Bad < 0 (-errno)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-06 16:49:15 +10:00
Angus Salkeld
e5ffd5a210 BSD: port new changes to BSD
- check for doxygen
- no RLIMIT_MSGQUEUE on bsd
- change ENODATA to ENOMSG

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-03 14:04:00 +10:00
Angus Salkeld
5221880227 automake: check for more headers
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-08-22 22:06:59 +10:00
Angus Salkeld
a6285e6f14 RB: add function qb_rb_chunks_used()
This is to make it easier to to see if there is
a chunk available to be read.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-08-09 16:59:26 +10:00
Angus Salkeld
edf994dc5c change name of ringbuffer.h to ringbuffer_int.h 2010-06-22 11:26:34 +10:00
Angus Salkeld
b8a5a74fcc hdb: move functions into cfile
convert int -> int32_t
rename qb_hdb_handle_t -> qb_handle_t
rename DECLARE_HDB_DATABASE -> QB_HDB_DECLARE
rename qb_hdb_handle_database -> qb_hdb

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-16 09:12:20 +10:00
Angus Salkeld
ec9a050a29 rb: make rb_chunk_peek() wait on the sem like chunk_read()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-15 12:56:23 +10:00
Angus Salkeld
e7975a77e3 rb: add a get name function
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-12 11:25:50 +10:00
Angus Salkeld
d9f93c15e5 rb: rename qb_rb_chunk_writable* -> qb_rb_chunk_
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-12 09:10:49 +10:00
Angus Salkeld
ae90c0d76e rb: cleanup of names and log messages
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-11 21:21:29 +10:00
Angus Salkeld
595bd54502 util: move some handy macros into qbuil.h
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-11 20:13:42 +10:00
Angus Salkeld
cd3c4a5ca6 rb: organise the locks/sems a bit better
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-11 12:00:43 +10:00
Angus Salkeld
0a23eb2be1 Format all files with Lindent
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-10 21:42:08 +10:00
Angus Salkeld
bd2c07f739 Add a ringbuffer based off the one in logsys.
This ringbuffer is usable across processes.
the point is to use this for IPC to provide async
connections from client to server, but with inherient
flow control.

This still needs a bit of clean up, but committing now
for feedback and as it is quite functional.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-10 12:44:27 +10:00