Recent "v1.0" discovered this discrepancy propagated all around
and also this is not very compatible with the logic of commit 26d3911.
Treat missing "patch" component of the version as an implicit zero
to make such oddity go away.
Adjust spec file generation accordingly.
Mainly as a light-weight alternative to full-blown autoconf/pkg-config
machineries, whereby one can:
* workaround functionality not present in libqb up to 1.0 (inclusive)
- note that this versioning schema is being introduced *after*
1.0.0 release so one cannot tell that version from any older,
but will be able to safely identify any later one (1.0.1+)
and act accordingly
- example:
#if !defined(QB_VER_MAJOR) || ((QB_VER_MAJOR == 1) && (QB_VER_MINOR < 1))
#warning "Feature X not supported"
int do_foo(int arg) { };
#else
int
do_foo(int arg)
{
/* use feature X of libqb */
}
#endif
* make its program report libqb API version it was built with by
emitting QB_VER_STR symbolic string (see tests/print_ver.c for example)
Also added is a print_ver test program to:
* emit how original unparsed version is parsed to particular components
defined in qbconfig.h (QB_VER_{MAJOR,MINOR,PATCH} symbolic integer
constants and QB_VER_REST symbolic string) when being compiled
* emit mentioned QB_VER_STR symbolic string joining the components
back to a single string, plus the components themselves
Resolves: https://github.com/ClusterLabs/libqb/issues/186
* configure.ac: Define QB_GNU.
Add a check for a working clock_getres for the CLOCK_MONOTONIC
option defining HAVE_CLOCK_GETRES_MONOTONIC.
* lib/log_thread.c: Replace second argument of
qb_log_thread_priority_set(): logt_sched_param.sched_priority by 0
when not supported by the OS.
* lib/util.c: Use the CLOCK_REALTIME option in clock_getres() if
HAVE_CLOCK_GETRES_MONOTONIC os not defined.
That's because the code relies on (fairly unportable) treatment by the
linker, specifically ld linker from binutils suite:
<https://sourceware.org/binutils/docs/ld/Orphan-Sections.html>
and without that in place, QB_HAVE_ATTRIBUTE_SECTION cannot be enabled
as the __{start,stop}_SECNAME extern references in qb/qblog.h will not
get resolved at the link time.
Original "qb_log_ctl" interface had to be extended for passing read-only
strings (new parameter), resulting in new "qb_log_ctl2" function, which
is what qb_log_ctl calls into with the new parameter set to NULL.
This ensures backward compatibility.
A new QB_LOG_CONF_IDENT configuration directive for the mentioned
interface is added with a goal to set new internal identifier
that is, notably, used for syslog sink. This allows for switching
the identification without a need to reinitialize logging subsystem,
akin to changing target logging facility.
Also a brand new concept of testing syslog sink in particular is
introduced (finally). During initial trial&error stage, it used
LD_PRELOAD hack but it seems that libtool is sophisticated enough
that no such extra intervention is needed and the desired symbol
resolution Just Works (tm). However, the technique is highly
non-portable (there is even a warning about that from libtool,
which is partially on purpose as the _syslog_override.so should
rather be explicit it is by no mean a regular library) and hence
the syslog tests have to be enabled with explicit
./configure --enable-syslog-tests
rather than possibly break on untested platforms (far too many).
The concept can be extended upon, but initially, just the new
feature is being tested.
Post-review: thanks Chrissie for a suggestion how to deal with
extract-arg-and-forget in a less intrusive way (no defines).
With gcc 5.3.1 20151207:
> log.c: In function 'cs_format':
> log.c:182:2: warning: function might be possible candidate for
> 'gnu_printf' format attribute [-Wsuggest-attribute=format]
> len = vsnprintf(str, QB_LOG_MAX_LEN, cs->format, ap_copy);
> ^
We certainly don't want to disable that warning globally so make use of
diagnostic pragmas for GCC instead in one instance that we cannot
annotate properly.
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
libqb fails to build on the hppa architecture, because the built-in
testcases fail as can be seen here:
http://buildd.debian-ports.org/status/fetch.php?pkg=libqb&arch=hppa&ver=0.17.0-2&stamp=1409458262
I did analyzed why they fail, and the reason is that on hppa we have
somewhat more complicated requirements (e.g. alignments) which needs to
be followed in order to mmap shared pages between processes. It's
different than what can be done compared to ia64 and sparc.
The attached patch fixes libqb on the hppa architecture and with it all
testcases finish successful.
By the way, I fixed a small typo in configure.ac too where arm platforms
prints "ia64"...
Forwarded-From: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=760199
Signed-off-by: Christoph Berg <myon@debian.org>
Using ./configure CC=clang, the following flags are detected
as supported:
checking whether clang supports "-Wgnu89-inline"... yes
checking whether clang supports "-Wno-strict-aliasing"... yes
Which results in a lot of warnings during make:
warning: unknown warning option '-Wunsigned-char' [-Wunknown-warning-option]
warning: unknown warning option '-Wgnu89-inline' [-Wunknown-warning-option]
Clang doesn't support these flags, but the compile check returns a
warning, not an error:
configure:16649: checking whether clang supports "-Wunsigned-char"
configure:16662: clang -E -Wunsigned-char conftest.c
warning: unknown warning option '-Wunsigned-char' [-Wunknown-warning-option]
1 warning generated.
configure:16662: $? = 0
configure:16663: result: yes
LIB_RT is unnecessary around. AC_CHECK_LIBS will do the right thing
similar for the other libs that are all exported via LIBS
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
this is required for all systems that don't use bash for /bin/sh
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This is just too painful for buildsystems like koji and travis.
You can't get access to the detailed output (error logs) that
otherwise be printed to screen.
I can't find a way to disable them on the command line (that
would be the best solution).
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
A bit reworked but originally from Igor Pashev:
84c47f8160
Note: __EXTENSIONS__ also defines _GNU_SOURCE, so removing it as well.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
timefd is using too much cpu and it is using up
file descriptors.
timelist is also more portable and now I have less
code to maintain.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
I like the automake options (and encourage other developers to
install the neccessary autotools).
Here is a handy script to install the newest autotools
into a private directory (if you can't get them pre-packaged).
http://people.redhat.com/meyering/autotools-install
autotools-install --prefix=$HOME/autotools --skip-check
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Autoconf warned about this:
configure.ac:72: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE\
call detected in body
That's warning about the use via AC_COMPILE_IFELSE without
specifying a language. The easiest way to work around that is
to avoid the use of CC altogether and instead to use the preprocessor.
* configure.ac (cc_supports_flag): Use AC_PREPROC_IFELSE in place
of AC_COMPILE_IFELSE (and CPPFLAGS in place of CFLAGS).
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
I ran "make check" in libqb and watched impatiently ;-)
as the tests ran in serial on my multi-core system.
If you add automake's "parallel-tests" option below, they'll
run in parallel.
The color-tests option makes it so the "PASS" and "FAIL" words
are colored green and red respectively. Nice, but no big deal.
Similarly nice-to-have is the "dist-xz" option.
That makes is so when you run "make dist" it creates xz-compressed
tarballs in addition to the usual gzip-compressed ones.
The advantage of also using xz is that it compresses significantly better:
$ du -sh *z
1.2M libqb-0.4.1.75-3737-dirty.tar.gz
812K libqb-0.4.1.75-3737-dirty.tar.xz
Now, whenever a project releases both gzip-compressed and
xz-compressed tarballs, I always download only the latter, smaller ones.
Not only does it save time on the download (minimal in this case),
but it occupies less space on disk and uncompresses faster.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This finds all the callsites in shared libraries
(using dl_iterate_phdr()) at the time qb_log_init()
is called.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Conflicts:
lib/log.c
compiler debug & optimization flags are only set with either
--enable-debug or --enable-coverage.
This prevents defaults and environmental flags from
been overridden.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
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>
Note: glib is only linked into the test app, so
libqb not dependant on glib. This is just testing
integration.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
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>
- 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>