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>
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>
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>
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>
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>
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>
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>
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>
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>
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>