ack_tracker: keep AckTracker parent class 64 bit aligned

AckTracker is a parent "class" for LateAckTracker which contains a RingBuffer.
RingBuffer has a pointer member which points to the memory where the AckRecord
slots (containing Bookmark) are stored.
When the AckTracker is unaligned then the RingBuffer within LateAckTracker
will also be unaligned and that can lead to SIGBUS on Sparc and IA64 platforms.

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
Merge pull request #169 from lbudai/f/merge-proto

ack_tracker: keep AckTracker parent class 64 bit aligned
bookmark: eliminate paddings (while keeping alignment well)

Using those paddings was a mistake: it makes code too breakable.
If we want to avoid bus error(or any other alignment issues)
on some stricter architectures(eg.:Sparc, IA64) what we have to do is
keep Bookmark aligned. For that reason we should choose carefully the
internal representation of the Bookmark.

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
Merge pull request #170 from lbudai/f/merge-proto

bookmark: eliminate paddings (while keeping alignment well)
log_pipe_init: handling result of log_pipe_init

Signed-off-by: Daniel Gados <gdani@balabit.hu>
Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logwriter: Implementing the late acknowledge mechanism on the writer's side

Signed-off-by: Daniel Gados <gdani@balabit.hu>
Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
ack_tracker: use AckType

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logmsg: adding the abort flag to the ack_and_ref member of LogMsg

It may happen that a message is sent to multiple destinations and
some of these destination have ack-ed the message but the queue of
the other writers have been freed. In this case these writers ack
the messages with AckType AT_ABORT which means that the message is
not processed and never will be.
To be correct we have to transfer the AT_ABORT all way along the
ack-path to notify the source that the message is not processed
on some paths and never will be to decrement the references to
the message. When the message is processed on all paths then the ack
is not only to decrement the references to the message but to change
the actual window size and save the actual buffer position to the
persist file.
The order of processed acks (AT_PROCESS) and unprocessed acks (AT_ABORT)
is undetermined. We have to accumulate the aborts and if at least one
writer acks with AT_ABORT (even if it is not the last one), we have to
transfer the AT_ABORT state to the source from log_msg_ack and
log_msg_refcache_stop.
To achive the above mentioned functionality the TLS_BLOCK has been
extended with a logmsg_cached_abort flag holding 0 or 1 and the member
ack_and_ref is change the following way: the lowest 15 bits hold the ref
counter (instead of 16 bits), then the next 15 bits hold the ack counter
(instead of 16 bits) and then 1 bit is holding the abort-flag (the last
one bit is unused at the moment).

test_logqueue: after changing the refcounter's size of logmsg the MESSAGES_PER_FEEDER is too high

Signed-off-by: Daniel Gados <gdani@balabit.hu>
Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logqueue: refactoring pop_head and adding log_queue_rewind_backlog to log_writer_flush

Signed-off-by: Daniel Gados <gdani@balabit.hu>
Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
Merge pull request #171 from lbudai/f/merge-proto

F/merge proto
configure.ac: Improved the linux capability check

The Linux capabilities check was dependent only on the existence of
<sys/capability.h>. While there was a check performed for -lcap and its
usability, if that check failed, linux capability support was never
turned off.

This caused problems on recent FreeBSDs, where the header exists, but -
naturally - the library does not. This patch fixes #175, by modifying
the check to turn off the feature if the library is not available.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>