Commit Graph

582 Commits

Author SHA1 Message Date
Angus Salkeld
359725f4fd Add atomic_int.h to noinst_HEADERS
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-05-13 11:59:42 +10:00
Angus Salkeld
67dc29f48d Use the new atomic ops in the ringbuffer
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-05-13 10:15:55 +10:00
Angus Salkeld
6f382aaade Add internal support for the new __atomic gcc builtins
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-05-13 10:15:55 +10:00
Angus Salkeld
d782f4216b Rename the configure macros from atomic to sync
This is so I can add support for the new atomic's which
are named __atomic.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-05-13 09:45:50 +10:00
Jeremy Fitzhardinge
9b3be0b450 ringbuffer: use atomic ops on ringbuffer chunk magic
The ringbuffer protocol uses the chunk magic number to indicate to the
other side what state a chunk is in.  It's therefore important to use
strongly ordered memory writes to make sure that neither the compiler
nor the CPU change the apparent order of the writes, since that would
result in corrupted messages.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-04-24 11:57:49 +10:00
Angus Salkeld
f54764e1ec IPC: make each connection ref the owning service
This is because the connection functions use the c->service pointer
and this needs to be mirrored in the reference counting.

The service can only be free'd when all connections are destroyed
and the user as unreferenced all previously referenced connections
and the service.

Fixes #62
Thanks to Jan Friesse for the reproducer
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-04-22 12:03:26 +10:00
Andrew Beekhof
f16dca6df9 Indicate when/why qb_rb_force_close() fails to remove share memory files 2013-04-11 13:00:12 +10:00
Angus Salkeld
7667536626 Deal better with corrupt blackbox files.
fixes #59
Thanks to Jan Friesse for the reproducer.
https://github.com/jfriesse/csts/blob/master/tests/fplay-segfault.sh

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-04-02 13:52:57 +11:00
Kazunori INOUE
1894470470 IPC: fix the connection state checking 2013-03-22 15:46:00 +09:00
Angus Salkeld
1c9104e334 LOG: copy the function/filename for dynamic callsites
callsites originate from the assumption that the function/filename/format
are all statically allocated. When moving to dynamic callsite we kept
this assumption. But people are now passing in function/file names that
later get free'd. So we need to make sure that they stay persistant by
allocating them ourselves.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-03-20 17:10:35 +11:00
Angus Salkeld
c445c06620 Properly discover SO_NOSIGPIPE and MSG_SIGNAL
bug #57
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-03-12 21:13:47 +11:00
Angus Salkeld
75a550d8d3 IPC: fix call to QB_SUN_LEN
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-03-12 20:45:47 +11:00
Angus Salkeld
2125310c93 rpl_sem: make destroy more compliant
don't block completely on the sem_wait(), but chop the waits
into 1 sec blocks so the destroy can have an opertunity to complete.

fixes bug #55

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-19 12:40:06 +11:00
Angus Salkeld
6ba054713e RB: make the "sem" abstraction into a notifier
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-18 23:25:10 +11:00
Angus Salkeld
59243fb68c IPC: clean up the connection state checking
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-18 23:02:30 +11:00
Angus Salkeld
31d9f0900d Use dgram sockets for message oriented communications
This is to prevent partial sends and gettting stuck in
retry loops.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-18 20:51:33 +11:00
Angus Salkeld
481bd0cf86 IPC: don't interpret EMSGSIZE and ENOMSG as a disconnect
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-18 20:51:33 +11:00
Angus Salkeld
3d7774816e POLL: prevent a spin if the fd is not removed from the mainloop
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-18 20:51:33 +11:00
Angus Salkeld
9d2eca251b IPC: seperate ipc_us.c into 2 files
Seperate into a setup file and a socket backend file, it was getting messy
and confusing. Also preparing for using DGRAM sockets.

This should not result in any logical changes.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-06 11:21:05 +11:00
Angus Salkeld
aa43bb94d1 IPC: move utility functions to unix.c
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-06 11:08:38 +11:00
Angus Salkeld
dde6a46a83 IPC: make sure we return a consistent error when the message is too big.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-01-25 11:20:19 +11:00
The Quarterback Library Release Team
848242a786 Bump the version to 0.14.4
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2013-01-17 14:06:48 +11:00
Angus Salkeld
45f181125c LOG: prevent the last char of the blackbox message from getting lost.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-01-17 13:55:48 +11:00
Takeshi MIZUTA
37a6e7a5f1 Add the processing which remove notifier at skiplist_destroy function 2013-01-15 01:57:29 +09:00
Takeshi MIZUTA
c684cdb55e Add the processing which remove hash node and notifier at hashtable_destroy function 2013-01-14 03:39:47 +09:00
Takeshi MIZUTA
4d1a98ad76 Unify to QB_TRUE/QB_FALSE a boolean value 2013-01-11 02:01:06 +09:00
Takeshi MIZUTA
96e504f305 Unify the list processing with qb_list function 2013-01-09 02:04:20 +09:00
miz-take
d365310882 Fix return code which is an error occurred at pthread function 2013-01-06 03:08:33 +09:00
Angus Salkeld
739faa54fe LOG: fix truncation in some messages that get padded.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-01-04 15:55:19 +11:00
Angus Salkeld
e07eccd6a6 Fix the blackbox formatter when specifing the string len/precision
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-19 10:51:54 +11:00
Angus Salkeld
aed8fe942e Fix strlcpy and strlcat functions
These were not behaving as the man pages described.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-19 10:42:08 +11:00
Angus Salkeld
fe45c27ea6 IPC: don't over log on disconnect
Thanks grueni: https://github.com/asalkeld/libqb/pull/43

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-10 10:46:01 +11:00
Angus Salkeld
c69713e5f9 Make sure we don't use the format string whilst it is getting changed.
Just add a rwlock around the usage.
Move qb_log_format_set() to log_format.c to make this easier.

Fixes #45

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-10 10:32:31 +11:00
Angus Salkeld
813dfb5fd2 ptrie: deref the current node in trie_iter_free()
If free'ing the iterator before getting to the last
node make sure we de-ref the current node. Else we
will not be able to delete the node.

fixes #44

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-06 11:59:33 +11:00
Angus Salkeld
30a7871646 LOG: fix the format comparison to avoid generating multiple entries.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-29 17:31:05 +11:00
Angus Salkeld
a5795f7d45 LOG: set the return code when calloc fails
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-23 10:24:56 +11:00
Angus Salkeld
709b32de43 IPC: call poll if we are mid message and get EAGAIN
So just manually call us_ready (poll) with a timeout of 50ms
to prevent cpu spin.

Also update qb_ipc_us_recv() to be simerlar.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-12 19:38:20 +11:00
Angus Salkeld
14f0250a89 Remove extra ";"
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-09 10:28:29 +11:00
Angus Salkeld
b535ef241b IPC: set the error more correctly when qb_sys_mmap_file_open() fails.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-09 10:28:06 +11:00
Angus Salkeld
839d14f0ec Make sure that mmap'ed files smaller than a page size are written to.
This is a test to make sure that there is actually enough memory
to back the requested shared memory.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-09 10:15:25 +11:00
The Quarterback Library Release Team
92ada8c4d1 Bump the library version.
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-10-29 10:02:04 +11:00
Andrew Beekhof
e771439c1c IPC: Pass the timeout to poll() if the recv function returns EAGAIN 2012-10-23 11:14:59 +11:00
Angus Salkeld
6e130725e4 LOG: make the format comparison safe and sane
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-23 10:35:05 +11:00
Angus Salkeld
a623af9696 LOG: don't break on empty callsites, just ignore them
else we might miss some callsites.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-23 10:34:23 +11:00
Angus Salkeld
435d1dbce2 LOG: use the array callback to register new callsites
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-23 10:33:00 +11:00
Angus Salkeld
5e955579cb array: add a mechanism to get a callback when a bin is allocated
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-23 10:31:47 +11:00
Angus Salkeld
79059bcae3 Solaris based operating systems don't define MSG_NOSIGNAL and SO_NOSIGPIPE.
They return SIGPIPE when send is used with a closed socket. A SIGPIPE handler
must be used or SIGPIPE should be set ignored with SIG_IGN. In this case send
returns -1 instead of a SIGPIPE. The setting to ignore SIGPIPE is global and
should be used only where it is absolutely necessary.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-22 11:15:05 +11:00
Angus Salkeld
bcba4a2983 Fix a crash in ptrie if you iterate over the map in the deleted notifier.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-09-12 10:39:17 +10:00
Angus Salkeld
aedcb97690 Make sure atomic's are initialized (for non-gcc atomic).
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-09-11 14:42:04 +10:00
The Quarterback Library Release Team
74b7c6e990 Bump the version to 0.14.2
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-09-10 10:58:14 +10:00