Commit Graph

294 Commits

Author SHA1 Message Date
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
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
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
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
Angus Salkeld
c5ed1450a1 IPC: add stats to server end.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-21 21:43:26 +11:00
Angus Salkeld
875a4f8d53 ATOMIC: fix the memory barrier setup.
This was horribly broken.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-20 11:31:44 +11:00
Angus Salkeld
9d8d6bfdce LINT: get the lint target working.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 22:36:08 +11:00
Angus Salkeld
f780aaea2d HDB: remove locks and use atomic.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 10:24:04 +11:00
Angus Salkeld
84488fdb85 HDB: use qb_array.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 09:54:12 +11:00
Angus Salkeld
f0efc457db DOCS: add some doxygen comments to array & hdb.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 08:59:51 +11:00
Angus Salkeld
9745d4feb7 Add a resizable array that doesn't move memory.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:54 +11:00
Angus Salkeld
e7b46822d5 ATOMIC: fix make distcheck
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:54 +11:00
Angus Salkeld
ec61d212d5 LIST/LOOP: allow empty list items but don't splice an empty head.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:54 +11:00
Angus Salkeld
43d8b36518 Add atomic operations.
This was initially copied from glib. How ever I have
simplified it to only support proper atomic operations
with gcc builtin __sync calls. The backup is pthread_spin_lock().
I have also obviously namespaced the code to qb_.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-18 11:24:07 +11:00
Angus Salkeld
47443a5b63 DOCS: do some work on the doxygen output.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-17 19:31:24 +11:00
Angus Salkeld
31ca215188 IPC: add support for unix sockets
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-17 14:23:53 +11:00
Angus Salkeld
ab3cc42537 LIST: fix logic in qb_list_splice()
this fixes "make check"

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-16 21:42:50 +11:00
Steven Dake
9e5385b885 qb_list_splice: don't splice an empty list
An empty list passed to splice will damage the target splice list.  This patch
prevents that from happening by checking for an empty list and not merging
in that case.

Signed-off-by: Steven Dake <sdake@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-15 07:36:35 +11:00
Angus Salkeld
e9d10dfdbe IPC: remove flow control API and move functionality into send()
There is no point in a separate API.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-14 09:16:00 +11:00
Angus Salkeld
0d9f8720b9 IPC: add qb_ipcc_sendv_recv() convenience function.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-13 10:01:30 +11:00
Angus Salkeld
e1686dbd6a IPC: add support for flowcontrol & rate limiting
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
8df21458f5 IPC: get the poll independent functions working.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
1f6c42b098 IPC: make msg_process return type int
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
57af215a96 Remove timer.c (rather use mainloop)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
08e5a9004d Add a priority based main loop.
This is to try and get a better balance in the amount
of processing between IPC and totem in corosync.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
3dcd1126f6 IPC: remove qb_ipcc_event_release()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:46:53 +11:00
Angus Salkeld
9fdecded41 LIST: add some more convenience macros.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:46:39 +11:00
Angus Salkeld
e0f942bfee IPC: teach event_recv() to take a timeout
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
9c0fa42f17 UTIL: add qb_timespec_add_ms()
add X milli seconds to a timespec.
add time defines to qbdefs.h

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
b95ed274bc IPC: make internal message ids negative.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
dc618488d2 IPC: add a user context_get/set() functions.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-06 20:39:23 +11:00
Angus Salkeld
c1a3b0d029 IPC: add sendv() functions to handle iovecs.
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
69f2c88081 IPC: add a service_id and merge qb_ipcs_create() + qb_ipcs_service_handlers_set()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-02 21:06:12 +10:00
Angus Salkeld
fcd0ca69d9 IPC: change the ipcs_connection to a pointer (not handle).
This is make integrating with corosync easier.
Also technically it doesn't really matter it still
has a reference counter.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-01 22:57:02 +10:00
Angus Salkeld
2aae94eb1d IPC: make authenticate callback more generic "accept".
This is so that it is more obvious that you can use
it for authentication, service availabilty and
process resource constraints.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-01 22:57:02 +10:00
Angus Salkeld
68938d3c9e LIST: add required header
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-01 22:57:02 +10:00
Angus Salkeld
ac6ed91a7d POLL: gracefully handle running out of file descriptors.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-01 22:57:02 +10:00
Angus Salkeld
e3a6cd6ad6 Delete unchecked API (to be re-added later).
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-30 20:49:11 +10:00
Angus Salkeld
86c84f6ae0 IPC: new auth improvement and limits work around.
Create the queues/ringbuffers on the server so we don't
have to modify proc entries. Then chown them so that
the clients can access them.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-30 20:17:59 +10: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
b6d4fb95b8 IPC: add events back (were dispatch messages in corosync)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-29 14:32:51 +10:00
Angus Salkeld
b29a1809f4 IPC: rename qb_ipcs_connection_pt -> qb_ipcs_connection_handle_t
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-29 14:32:51 +10:00
Angus Salkeld
64b4aac413 IPC: un-const the data pointer in recv()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-29 14:32:51 +10:00
Angus Salkeld
b28173ee81 IPC: get shm & pmq working
Note: pmq needs "sudo make check"

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-09-07 14:11:42 +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
8a6b8d78db IPC: rewrite (simpler API & more structured layout).
- implement using posix message queues
- implement using sys-v message queues
- implement shared memory ringbuffers
- add auth via unix sockets
- add items to the TODO

This is still a bit rough, more work to follow...

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-08-23 12:46:36 +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
f04f1abcf0 POLL: add a job API to process non-fd items.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-07-28 21:12:11 +10:00
Angus Salkeld
41c06ef6e6 int -> int32_t
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-22 11:55:09 +10:00
Angus Salkeld
60b11eee49 unsigned int -> uint32_t
some to int32_t (bugs)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-22 11:54:58 +10:00
Angus Salkeld
cdb9d32de4 unsigned long long -> uint64_t
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-22 11:28:56 +10:00
Angus Salkeld
2432ca85b9 list: rename QB_DECLARE_LIST_INIT -> QB_LIST_DECLARE
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-16 13:24:14 +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
87f204469a ipc: convert int -> int32_t; unsigned int -> uint32_t
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-15 14:46:52 +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
35e062e275 rb: fix bit flag numbering
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
2787bea55c list: add some more doxygen comments
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-12 10:47:41 +10:00
Angus Salkeld
3f2c3b9906 rb: add an example to the doxygen description.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-12 10:47:10 +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
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
e6d5f32f9f Bring some changes across from corosync.
My coverity fixes and honzas fixes.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-11 09:51:53 +10:00
Angus Salkeld
7a90cdda1f Remove unneccessary extern's.
http://gcc.gnu.org/ml/gcc/2009-04/msg00812.html
http://publications.gbdirect.co.uk/c_book/chapter4/linkage.html
http://www.eskimo.com/~scs/cclass/notes/sx5b.html

note in ipcs.c qb_ipcs_ipc_init() is extern'ed, I don't
think that this is needed - we'll soon see :)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-06-11 08:29:31 +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
Angus Salkeld
6b052988a9 man: document qblist.h better.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-31 15:22:12 +10:00
Angus Salkeld
8ff8c7bfba Add __cplusplus externs
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-25 21:53:40 +10:00
Angus Salkeld
29cee5ec5e use new interanl logging functions
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-25 15:53:44 +10:00
Angus Salkeld
396fb4f375 Add a library logging function.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-25 15:07:54 +10:00
Angus Salkeld
5f7d3749c9 Add a util library with locking wrappers.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-25 15:06:41 +10:00
Angus Salkeld
caecbe6542 Re-license to LGPL 2.1
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-05-25 06:11:59 +10:00
Angus Salkeld
f0834863c6 fix "make distcheck"
I am sure that I am going to learn one day :(

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-29 21:24:21 +10:00
Angus Salkeld
74a7a49354 ipc: add a non-blocking send function.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-29 14:47:42 +10:00
Angus Salkeld
3eb313a848 ipc: add common types to qbipc_common.h
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-29 11:23:35 +10:00
Angus Salkeld
e9467c988c ipc: remove uneccessary version compatibilty
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-29 11:22:45 +10:00
Angus Salkeld
c6134b367c add a unit test for hash & cleanup.
Fix make distcheck
    Add qbhash.h to the makefiles
    Fix make rpm.
    Make sure the makefiles are generatd for hash

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-15 12:19:08 +10:00
Steven Dake
82e984fe38 Add an initial implementation of a hash table.
The hash table implementation is somewhat unique in that I plan to add graph
functionality to allow hash entries to be linked between other hash
entries to provide a mechanism to structure data within a hash table.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-04-15 08:00:56 +10:00
Angus Salkeld
b64457e19e add logsys from corosync.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-20 21:40:03 +11:00
Angus Salkeld
2bea1f4f65 Add wthread & queue.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-20 21:23:19 +11:00
Angus Salkeld
428003888a add ipcs from corosync
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 15:04:21 +11:00
Angus Salkeld
ceff27f370 Add ipcc from corosync
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 14:42:25 +11:00
Angus Salkeld
c7e93f2f5c add the plugin library.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 14:36:04 +11:00
Angus Salkeld
b503a98acf Added qb_ prefix onto public functions/types.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 14:28:22 +11:00
Angus Salkeld
1aee5e128b Add timer.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-19 14:25:35 +11:00
Angus Salkeld
81facf8267 Add poll, list & tlist
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-11 15:54:03 +11:00
Angus Salkeld
50bcb27284 Add handle database.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-11 14:52:57 +11:00
Angus Salkeld
69d77500df Initial Commit.
-autotools build system
-tsafe

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-03-11 14:19:39 +11:00