qb_log calls malloc() and probably many other non-signal-safe
functions, so don't call it in the signal handler.
Thanks to Honza for spotting this
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
* tlist: Add heap based implementation of timer list
Previous timer was sorted list implementation of priority queue
and very slow when number of timers increased. This is mostly
not a problem because usually only few timers are used.
But for application where bigger number of timers are needed
it may become problem.
Solution is to use binary heap based priority queue which is much
faster.
API is unchanged, just timerlist_destroy is added which should be called
to free heap array. This function also destroys mutex (omitted when
mutex was added).
* tests: Fix check loop mt test
test_th was accesed both by main thread and loop_timer thread resulting in
failure. Fix is to access test_tht in loop_timer thread.
Speed test is adding only 10000 items so it is reasonable
fast even with sorted linked list implementation.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
The message-id parameter will enable systemd catalogs.
To enable message-id's the libqb should be configured with the
--enable-systemd-journal option.
Co-authored-by: root <Aleksei Burlakov>
This is an attempt to make sure that /dev/shm is cleaned up when a
server exits unexpectedly. Normally it's the server's responsibility
to tidy up sockets, but if it crashes or is killed with SIGKILL then
the client (us) makes a reasonable attempt to tidy up the server sockets
we have connected. The extra delay here just gives the server chance to
disappear fully. As a client we can get here pretty quickly but shutting
down a large server may take a little longer even when SIGKILLed.
The 1/100th of a second is an arbitrary delay (of course) but seems to
catch most servers in 2 tries or less.
if a line starts with a '.' (eg the '...' in qbarray.h) then
nroff thinks it's looking for a macro called '..'.
The easiest solution is to add a dummy format at the start of the line
(just adding \ seems not to work).
* ipc: addd qb_ipcc_auth_get() API call
We can't use SO_PEERCRED on the client fd when using socket IPC
becayse it's a DGRAM socket (pacemaker tries this). So provide
an API to get the server credentials that libqb has already
squirreled away for its own purposes.
Also, fix some unused-variable compiler warnings in unix.c
when building on systems without posix_fallocate().
* doxygen2man: Add option to read copyright line from the header file
This should help make builds reproducible.
I tried various methods of getting the date, using 'git' is no use as
it could be run from a tarball, using the file date doesn't work either
so this seems a reasonable compromise.
* man: Use SOURCE_EPOCH to make manpage dates reproducible
Also add build-aux/update-copyright.sh to keep header file
copyright lines up-to-date.
All code taken from knet
Using of posix_fallocate() guarantees that, if it succeed, the
attempting to write to allocated space range does not fail because of
lack of storage space. This prevents SIGBUS when trying to write to
mmaped file and no space left.
Co-Authored-by: Ivan Zakharyaschev <imz@altlinux.org>
Reported-by: Mikhail Kulagin <m.kulagin at postgrespro dot ru>
Co-authored-by: Ivan Zakharyaschev <imz@altlinux.org>
* man: Use doxygen2man to make the API manpages
* [build] drop unused target
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
* [build] update gitignore
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
* [docs] make build -j safe and drop unnecessary dox config files
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
* man: Use doxygen2man to generate *.h.3 man pages
so we don't need to use the awful doxygen ones
Co-authored-by: Fabio M. Di Nitto <fdinitto@redhat.com>
doxygen2man: Lots of fixes and features
a) Make it quieter in normal operation
b) add options for hard coded things (like company name)
c) handle typedef members of structures
d) tidy function pointers in structs
e) get header file name from the XML or commandline
d) Add support for @ref tags in description
e) add support for @note annotations
f) Don't print (null) if there is no @brief description
g) Add include prefix option
h) use strncat rather than strcat
It's possible that cs->filename or cs->format could be read
in the 'fast' path while the 'slow' path is still constructing
the object. So we need to lock arr_next_lock before copying them
out for the caller.
Also wthread_should_exit was unprotected.
It's hard to predict the length of formatted output, so we'd better
notice (and abort) if the description is truncated. Incidentally,
mkdtemp() does this for us in the shared memory branch, but do an
explicit check there as well for consistency, and get rid of the wrongly
parametrized strncat() risking a buffer overflow (CONNECTION_DESCRIPTION
is not the length of the source "/qb").
Similar truncation checks should be added to qb_ipcs_{shm,us}_connect()
where they build the request/response names, and possibly to other
places using snprintf().
* doxygen2man: Add utility to generate man pages from doxygen
This is in here from kronosnet so it cna be used by other parts
of the cluster stack.
* [man] drop trailing white spaces
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
* [build] cleanup variable names
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
* [build] add conditionals to use internal or external doxygen2man
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
* Update .gitignore
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Co-authored-by: Christine Caulfield <ccaulfie@redhat.com>