Commit Graph

174 Commits

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